[FFmpeg-devel] [PATCH 3/3] lavc/libxvid: workaround for bug in libxvidcore

Michael Niedermayer michaelni at gmx.at
Thu Dec 4 00:42:54 CET 2014


On Thu, Dec 04, 2014 at 12:39:29AM +0100, Lukasz Marek wrote:
> On 24.11.2014 01:17, Lukasz Marek wrote:
> >libxvidcore calculate number of threads basing on video height.
> >If height is small enough it allocates 0 bytes long memory and
> >writes to it.
> >Setting thread_count to 0 uses 1 thread and skips bugged code.
> >
> >Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> >---
> >  libavcodec/libxvid.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> >diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
> >index 70d52b9..efe7b8a 100644
> >--- a/libavcodec/libxvid.c
> >+++ b/libavcodec/libxvid.c
> >@@ -471,6 +471,17 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)
> >      xvid_enc_create.num_zones = 0;
> >
> >      xvid_enc_create.num_threads = avctx->thread_count;
> >+    /* workaround for a bug in libxvidcore */
> >+    if (avctx->height < 18) {
> >+        if (avctx->thread_count < 2) {
> >+            xvid_enc_create.num_threads = 0;
> >+        } else {
> >+            av_log(avctx, AV_LOG_ERROR,
> >+                   "Too small height for threads > 1.");
> >+            ret = AVERROR(EINVAL);
> >+            goto fail;
> >+        }
> >+    }
> >
> >      xvid_enc_create.plugins     = plugins;
> >      xvid_enc_create.num_plugins = 0;
> >
> 
> Please comment this patch. xvid accepted fix for it.
> Personally I don't care, but when configured "correctly" ffmpeg is
> using not allocated memory via external library.
> I just don't know if keep it or just forget about it.

patch LGTM

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141204/5d06d0ca/attachment.asc>


More information about the ffmpeg-devel mailing list