Skip to content

Commit

Permalink
decavcodec: don't try to memset NULL buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
jstebbins committed Nov 6, 2015
1 parent f7b0c57 commit 96b99ea
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libhb/decavcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,10 @@ static int decavcodecaWork( hb_work_object_t * w, hb_buffer_t ** 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->data != NULL)
{
memset(in->data + in->size, 0, in->alloc - in->size);
}

if (in->s.flags & HB_BUF_FLAG_EOF)
{
Expand Down Expand Up @@ -1790,7 +1793,10 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** 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->data != NULL)
{
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)
Expand Down

0 comments on commit 96b99ea

Please sign in to comment.