]> git.vomp.tv Git - vompclient.git/commitdiff
Fix demuxer long hang on invalid video stream data
authorChris Tallon <chris@vomp.tv>
Thu, 9 Feb 2017 23:09:00 +0000 (23:09 +0000)
committerChris Tallon <chris@vomp.tv>
Thu, 9 Feb 2017 23:09:00 +0000 (23:09 +0000)
demuxer.cc

index 50343cb101f59d737c1f354c9e187fad88cc3632..a38b0de873f964fe7340c40e9a000b05d2845e1a 100644 (file)
@@ -156,7 +156,7 @@ UINT NALUUnit::getUe()
     bool bit;
     for( bit = 0; !bit && !eonalu; leadbits++ )
         bit = getBits(1);
-    if (eonalu) return true;
+    if (eonalu) return 0;
     return ((1 << leadbits)-1)+getBits(leadbits);
 }
 
@@ -383,7 +383,17 @@ UINT PESPacket::countPictureHeaders(bool h264, struct PictCountInfo& pinfo) cons
                                      }
                                  }
 
-                                 pinfo.log2_max_frame_num=nalu.getUe()+4; //log2framenum
+                                 UINT checkMaxFrameNum = nalu.getUe() + 4;  //log2framenum
+
+                                 if (checkMaxFrameNum < 13) {
+                                       pinfo.log2_max_frame_num = checkMaxFrameNum;
+                                 }
+                                 else {
+                                       pattern=0xFFFFFF;
+                                       pos+=nalu.getPos();
+                                       continue;
+                                 }
+
                                  UINT temp=nalu.getUe();
                                  if (temp==0) //pict order
                                          nalu.getUe();