OSDN Git Service

mxfdec: Don't crash in mxf_packet_timestamps() if current_edit_unit overflows
authorTomas Härdin <tomas.hardin@codemill.se>
Thu, 26 Jan 2012 12:21:41 +0000 (13:21 +0100)
committerDiego Biurrun <diego@biurrun.de>
Thu, 9 Feb 2012 11:54:14 +0000 (12:54 +0100)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
libavformat/mxfdec.c

index 25d8c2b..5043d4e 100644 (file)
@@ -1798,7 +1798,7 @@ static void mxf_packet_timestamps(MXFContext *mxf, AVPacket *pkt)
         return;
 
     /* find mxf->current_edit_unit so that the next edit unit starts ahead of pkt->pos */
-    for (;;) {
+    while (mxf->current_edit_unit >= 0) {
         if (mxf_edit_unit_absolute_offset(mxf, t, mxf->current_edit_unit + 1, NULL, &next_ofs, 0) < 0)
             break;
 
@@ -1817,7 +1817,7 @@ static void mxf_packet_timestamps(MXFContext *mxf, AVPacket *pkt)
         mxf->current_edit_unit++;
     }
 
-    if (mxf->current_edit_unit >= t->nb_ptses)
+    if (mxf->current_edit_unit < 0 || mxf->current_edit_unit >= t->nb_ptses)
         return;
 
     pkt->dts = mxf->current_edit_unit + t->first_dts;