diff options
author | John Stebbins <[email protected]> | 2015-11-06 13:00:14 -0800 |
---|---|---|
committer | John Stebbins <[email protected]> | 2015-11-06 13:00:14 -0800 |
commit | f7b0c5773abe43b003295ecf631c83cc43a1ee91 (patch) | |
tree | c29f794c244b5727f96605d6714848f52807e224 /libhb/decavcodec.c | |
parent | 671306b1fdddcc94da546d9c273046a58e3124c8 (diff) |
decavcodec: fix hang in avcodec decoder
libavcodec/mpeg12dec.c expects input buffers to be zero padded to 32 bit
alignment. If not zero padded, it can get caught in an infinite loop.
Diffstat (limited to 'libhb/decavcodec.c')
-rw-r--r-- | libhb/decavcodec.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c index bcfea83a8..215a58902 100644 --- a/libhb/decavcodec.c +++ b/libhb/decavcodec.c @@ -529,6 +529,11 @@ static int decavcodecaWork( hb_work_object_t * w, hb_buffer_t ** buf_in, hb_work_private_t * pv = w->private_data; hb_buffer_t * in = *buf_in; + // libavcodec/mpeg12dec.c requires buffers to be zero padded. + // If not zero padded, it can get stuck in an infinite loop. + // It's likely there are other decoders that expect the same. + memset(in->data + in->size, 0, in->alloc - in->size); + if (in->s.flags & HB_BUF_FLAG_EOF) { /* EOF on input stream - send it downstream & say that we're done */ @@ -1782,6 +1787,11 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in, *buf_in = NULL; *buf_out = NULL; + // libavcodec/mpeg12dec.c requires buffers to be zero padded. + // If not zero padded, it can get stuck in an infinite loop. + // It's likely there are other decoders that expect the same. + memset(in->data + in->size, 0, in->alloc - in->size); + /* if we got an empty buffer signaling end-of-stream send it downstream */ if (in->s.flags & HB_BUF_FLAG_EOF) { |