From 79057e3ff58933aea900e4eb50e6e46c7883c582 Mon Sep 17 00:00:00 2001 From: Gleb Popov Date: Sun, 2 Jun 2019 06:35:43 +0000 Subject: [PATCH] multimedia/zoneminder: Fix MP4 file generation by patching UB bug in src/zm_video.cpp file. The patch has also been merged upstream: https://github.com/ZoneMinder/zoneminder/pull/2628 Reviewed by: abi@abinet.ru (maintainer) Approved by: tcberner (mentor, implicit) --- multimedia/zoneminder/Makefile | 2 +- .../zoneminder/files/patch-src_zm__video.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 multimedia/zoneminder/files/patch-src_zm__video.cpp diff --git a/multimedia/zoneminder/Makefile b/multimedia/zoneminder/Makefile index 58307e8b7eaa..cc8a36836040 100644 --- a/multimedia/zoneminder/Makefile +++ b/multimedia/zoneminder/Makefile @@ -2,7 +2,7 @@ PORTNAME= zoneminder PORTVERSION= 1.32.3 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= multimedia MAINTAINER= bsd@abinet.ru diff --git a/multimedia/zoneminder/files/patch-src_zm__video.cpp b/multimedia/zoneminder/files/patch-src_zm__video.cpp new file mode 100644 index 000000000000..ae0b8ba34107 --- /dev/null +++ b/multimedia/zoneminder/files/patch-src_zm__video.cpp @@ -0,0 +1,17 @@ +--- src/zm_video.cpp.orig 2018-12-08 14:22:36 UTC ++++ src/zm_video.cpp +@@ -455,11 +455,12 @@ int X264MP4Writer::x264encodeloop(bool bFlush) { + + /* Write the sample */ + if ( !buffer.empty() ) { ++ unsigned int bufSize = buffer.size(); + if ( !MP4WriteSample( + mp4h, + mp4vtid, +- buffer.extract(buffer.size()), +- buffer.size(), ++ buffer.extract(bufSize), ++ bufSize, + duration, + offset, + prevKeyframe) ) {