mpegenc: prevent a NULL pointer dereference
authorVittorio Giovara <vittorio.giovara@gmail.com>
Fri, 21 Nov 2014 12:57:42 +0000 (12:57 +0000)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Mon, 24 Nov 2014 01:30:14 +0000 (01:30 +0000)
CC: libav-stable@libav.org
Bug-Id: CID 29261

libavformat/mpegenc.c

index fed03ed..9640893 100644 (file)
@@ -1057,7 +1057,7 @@ retry:
         es_size              -= stream->premux_packet->unwritten_size;
         stream->premux_packet = stream->premux_packet->next;
     }
         es_size              -= stream->premux_packet->unwritten_size;
         stream->premux_packet = stream->premux_packet->next;
     }
-    if (es_size)
+    if (stream->premux_packet && es_size)
         stream->premux_packet->unwritten_size -= es_size;
 
     if (remove_decoded_packets(ctx, s->last_scr) < 0)
         stream->premux_packet->unwritten_size -= es_size;
 
     if (remove_decoded_packets(ctx, s->last_scr) < 0)