]> granicus.if.org Git - handbrake/commitdiff
decavcodec: don't try to memset NULL buffers
authorJohn Stebbins <jstebbins.hb@gmail.com>
Fri, 6 Nov 2015 21:24:27 +0000 (13:24 -0800)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Fri, 6 Nov 2015 21:24:27 +0000 (13:24 -0800)
libhb/decavcodec.c

index 215a589025e1c5d6541868942d6ccbf44ccdef43..ab801192294f2b7b6dad3edd09d0dabe3903527d 100644 (file)
@@ -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)
     {
@@ -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)