]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
sanity checks for mkv muxer
authorJohn Törnblom <john.tornblom@gmail.com>
Thu, 8 Mar 2012 09:53:07 +0000 (10:53 +0100)
committerJohn Törnblom <john.tornblom@gmail.com>
Thu, 8 Mar 2012 09:53:07 +0000 (10:53 +0100)
src/dvr/mkmux.c

index 54a350cedf16a59a3fb29a5de73ecd27ded01dd4..1303d69f9593997094be400166b3e813d97daea2 100644 (file)
@@ -810,10 +810,13 @@ mk_write_frame_i(mk_mux_t *mkm, mk_track *t, th_pkt_t *pkt)
   int skippable = pkt->pkt_frametype == PKT_B_FRAME;
   int vkeyframe = SCT_ISVIDEO(t->type) && keyframe;
 
-  uint8_t *data;
-  size_t len;
+  uint8_t *data = pktbuf_ptr(pkt->pkt_payload);
+  size_t len = pktbuf_len(pkt->pkt_payload);
   const int clusersizemax = 2000000;
 
+  if(!data || len <= 0)
+    return;
+
   if(pts == PTS_UNSET)
     // This is our best guess, it might be wrong but... oh well
     pts = t->nextpts;
@@ -863,10 +866,6 @@ mk_write_frame_i(mk_mux_t *mkm, mk_track *t, th_pkt_t *pkt)
     addcue(mkm, pts, t->tracknum);
   }
 
-
-  data = pktbuf_ptr(pkt->pkt_payload);
-  len  = pktbuf_len(pkt->pkt_payload);
-
   if(t->type == SCT_AAC || t->type == SCT_MP4A) {
     // Skip ADTS header
     if(len < 7)