]> granicus.if.org Git - handbrake/commitdiff
libhb: fix segfault when decoding empty audio track
authorJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 29 May 2018 19:59:42 +0000 (12:59 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Tue, 29 May 2018 20:03:20 +0000 (13:03 -0700)
If an audio track exists, but we receive no audio packets for that
track, this causes a condition that results in a NULL dereference.

Fixes https://github.com/HandBrake/HandBrake/issues/1358

(cherry picked from commit 4b3aa7b434e5af45997cdd8c34a310aa654a304b)

libhb/decavcodec.c

index 28d260596ecad5bd8a3f13d1be10a91f6080f225..0cdb78ea63417f1f5e2fc84b7edbf850009db10d 100644 (file)
@@ -2138,7 +2138,8 @@ static void decodeAudio(hb_work_private_t *pv, packet_info_t * packet_info)
     // libav does not supply timestamps for wmapro audio (possibly others)
     // if there is an input timestamp, initialize next_pts
     if (pv->next_pts     == (int64_t)AV_NOPTS_VALUE &&
-        packet_info->pts !=          AV_NOPTS_VALUE)
+        packet_info      != NULL &&
+        packet_info->pts != AV_NOPTS_VALUE)
     {
         pv->next_pts = packet_info->pts;
     }