Your message dated Wed, 03 Oct 2018 21:41:49 +0000
with message-id <[email protected]>
and subject line Bug#901735: fixed in mediastreamer2 1:2.16.1-3
has caused the Debian Bug report #901735,
regarding mediastreamer2: hardcodes wrong FF_INPUT_BUFFER_PADDING_SIZE value
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
901735: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901735
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Source: mediastreamer2
Version: 1:2.16.1-2
Severity: normal
Tags: patch

Hi,

mediastreamer2 contains this:
(src/videofilters/nowebcam.c)
> #if __clang__
> #pragma clang diagnostic push
> #pragma clang diagnostic ignored "-Wdeprecated-declarations"
> #endif
> 
> #define FF_INPUT_BUFFER_PADDING_SIZE 32
> 
> #if LIBAVCODEC_VERSION_MAJOR >= 57
> 
> #ifdef _MSC_VER
> #pragma warning(disable : 4996)
[...]
>               if (statbuf.st_size <= 0) {
>                       close(fd);
>                       ms_error("Cannot load %s", jpgpath);
>                       return NULL;
>               }
>               jpgbuf=(uint8_t*)ms_malloc0(statbuf.st_size + 
> FF_INPUT_BUFFER_PADDING_SIZE);
>               if (jpgbuf == NULL) {
>                       close(fd);
>                       ms_error("Cannot allocate buffer for %s", jpgpath);
>                       return NULL;
>               }

This is likely to break (ie segfault somewhere) once the FFmpeg 4.0
transition starts because FFmpeg 4.0 has increased the required input
buffer padding to 64 bytes. If mediastreamer2 had used the correct
constant (AV_INPUT_BUFFER_PADDING_SIZE) then it would require no changes.

I think the reason for writing the code this way is to support
non-ffmpeg builds. Based on that, I've attached a patch which I think
will be OK for both Debian and upstream.

James
Description: Use AV_INPUT_BUFFER_PADDING_SIZE to determine padding size
 Hardcoding the value for FF_INPUT_BUFFER_PADDING_SIZE is not safe because
 upstream FFmpeg might change it (as they did in FFmpeg 4.0).
 .
 Instead, use FFmpeg's AV_INPUT_BUFFER_PADDING_SIZE if available and only
 hardcode a value if FFmpeg is disabled (in which case the value doesn't
 particularly matter anyway). For compatibility with older FFmpeg versions,
 define AV_INPUT_BUFFER_PADDING_SIZE if hasn't been defined yet.
Author: James Cowgill <[email protected]>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/videofilters/ffmpegnowebcam.c
+++ b/src/videofilters/ffmpegnowebcam.c
@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fi
 #ifndef NO_FFMPEG
 #include "ffmpeg-priv.h"
 #else
-#define FF_INPUT_BUFFER_PADDING_SIZE 32
+#define AV_INPUT_BUFFER_PADDING_SIZE 32
 #endif
 
 #if LIBAVCODEC_VERSION_MAJOR >= 57
--- a/src/videofilters/nowebcam.c
+++ b/src/videofilters/nowebcam.c
@@ -34,7 +34,11 @@ Foundation, Inc., 51 Franklin Street, Fi
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
 #endif
 
-#define FF_INPUT_BUFFER_PADDING_SIZE 32
+#ifndef NO_FFMPEG
+#include "ffmpeg-priv.h"
+#else
+#define AV_INPUT_BUFFER_PADDING_SIZE 32
+#endif
 
 #if LIBAVCODEC_VERSION_MAJOR >= 57
 
@@ -130,7 +134,7 @@ static mblk_t *_ms_load_jpeg_as_yuv(cons
 			ms_error("Cannot load %s", jpgpath);
 			return NULL;
 		}
-		jpgbuf=(uint8_t*)ms_malloc0(statbuf.st_size + FF_INPUT_BUFFER_PADDING_SIZE);
+		jpgbuf=(uint8_t*)ms_malloc0(statbuf.st_size + AV_INPUT_BUFFER_PADDING_SIZE);
 		if (jpgbuf == NULL) {
 			close(fd);
 			ms_error("Cannot allocate buffer for %s", jpgpath);
--- a/src/utils/ffmpeg-priv.h
+++ b/src/utils/ffmpeg-priv.h
@@ -102,6 +102,10 @@ static inline int avcodec_decode_video2(
 #endif
 #endif
 
+#ifndef AV_INPUT_BUFFER_PADDING_SIZE
+    #define AV_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
+#endif
+
 #ifndef HAVE_FUN_avcodec_encode_video2
 int avcodec_encode_video2 (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr);
 #endif

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
Source: mediastreamer2
Source-Version: 1:2.16.1-3

We believe that the bug you reported is fixed in the latest version of
mediastreamer2, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Bernhard Schmidt <[email protected]> (supplier of updated mediastreamer2 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Wed, 03 Oct 2018 22:08:36 +0200
Source: mediastreamer2
Binary: libmediastreamer-base10 libmediastreamer-dev libmediastreamer-voip10
Architecture: source
Version: 1:2.16.1-3
Distribution: experimental
Urgency: medium
Maintainer: Debian VoIP Team <[email protected]>
Changed-By: Bernhard Schmidt <[email protected]>
Description:
 libmediastreamer-base10 - Voice and video streaming engine for telephony (base)
 libmediastreamer-dev - Development files for the mediastreamer2 library
 libmediastreamer-voip10 - Voice and video streaming engine for telephony (voip)
Closes: 901735 905481
Changes:
 mediastreamer2 (1:2.16.1-3) experimental; urgency=medium
 .
   * Team upload.
 .
   [ Dr. Tobias Quathamer ]
   * Switch Vcs-URLs to salsa.d.o
   * Add patch to fix possible breakage with FFmpeg 4.0.
     Thanks to James Cowgill <[email protected]> (Closes: #901735)
   * Use debhelper v11
   * Update Standards-Version to 4.1.4, no changes needed
 .
   [ Bernhard Schmidt ]
   * Switch to libsrtp2, cherry-picking an upstream commit
   * Fix FTBFS with GCC-8 (cherry-pick two upstream commits) (Closes: #905481)
   * remove superfluous libmediastreamer-dev.docs
Checksums-Sha1:
 bbd8d522acf2f149014e044a4b399829d3040526 2954 mediastreamer2_2.16.1-3.dsc
 47a9e954b099003f60bf7355cf4c86e03d7fe516 19876 
mediastreamer2_2.16.1-3.debian.tar.xz
 130c37d2f0a2a24102a1a61d35147e6829a98cdb 16158 
mediastreamer2_2.16.1-3_amd64.buildinfo
Checksums-Sha256:
 5935a2a584cd02fd436b79880ad00dfe59f2f7b3a8cc55c88ad60333e0f2c939 2954 
mediastreamer2_2.16.1-3.dsc
 fc8484cd76a96ab35794f409a9dcf42155437ce1850a8edeea56a6bb74565ea9 19876 
mediastreamer2_2.16.1-3.debian.tar.xz
 51375981062da89d22fe681b34044fc3ca6c333134071c714fd1672d58080f21 16158 
mediastreamer2_2.16.1-3_amd64.buildinfo
Files:
 950607447f794bf3118dea5c7f08caf0 2954 libs optional mediastreamer2_2.16.1-3.dsc
 a7f13f277db3b31b93708719b4caa1a2 19876 libs optional 
mediastreamer2_2.16.1-3.debian.tar.xz
 a20307a6999a81e0dc161f1ee4f8c49e 16158 libs optional 
mediastreamer2_2.16.1-3_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJFBAEBCgAvFiEE1uAexRal3873GVbTd1B55bhQvJMFAlu1JgkRHGJlcm5pQGRl
Ymlhbi5vcmcACgkQd1B55bhQvJMv2g//a57TyKT6OsHmCBhplLggovAGOwXTJQFv
f/Vriwp30YM3RRUJ8ubvCNZrue6dF/gF9De5Zc7sPonaCLWQPDrVloGoAVWWNWII
Z3PZgzFQNRrv78MR4SVTrRZn1xMVcyUiHeTT1yyClFXD5L6IP2KB5tbztxSPAb1E
Tl5VHzp2fQksIxpZn5Xqyyu7ox1As67QL7MIaAmPF6EbHmktvXUK6m2vASkLq7nh
s4vznCIpE1e/Gtl9/FRxDSa0/72/adcIsEaQ3cE0WGKiwWPRhsWFoomFRV+rPq4X
pPvWjsL024gl5PnBws3xk+DsUONRN9mNP/Ke5D8u5DyzHMwU9FuNF5bqqZGv6Ki+
MgrJ2Muv03tAEwj0NYC5aFNRLUUHx5uU0FF5BcLKOzWclqjKdlgXIlGnDGRefHQM
YyjM657eaH8Ljl3MZZWmkXmKM1ol9WiS8gjMcJZ1HI/vEv9ElfusORzonFBrfp23
jB1mOd5TOq9yXwY2x5KZO3y3OudWOkatLyOyLJWSiV1cl0kcsNe4HbIvkotg2oR9
58zHrqL0xh/W+Vi01DqAf/6OTX1ujJjC7n30gW4wFtzSZ9vzCz96B1Tc17ewG6+X
DyUmYdIRGhcHC4Hy+Ntr7UVT32LVMMZ9Q33tQJ/lfwKyMofQnW3ubVkLAINYGGgY
4qv9Dxny1iI=
=P7u6
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to