Author: duncan
Date: Sun Dec  3 14:57:11 2006
New Revision: 2149

Modified:
   trunk/metadata/src/video/mpeginfo.py

Log:
When the buffer is empty, it causes a crash in ReadSCRMpeg1
This fix ensures that crash can't happen.


Modified: trunk/metadata/src/video/mpeginfo.py
==============================================================================
--- trunk/metadata/src/video/mpeginfo.py        (original)
+++ trunk/metadata/src/video/mpeginfo.py        Sun Dec  3 14:57:11 2006
@@ -293,6 +293,9 @@
         """
         read SCR (timestamp) for MPEG2 at the buffer beginning (6 Bytes)
         """
+        if len(buffer) < 6:
+            return -1
+
         highbit = (ord(buffer[0])&0x20)>>5
 
         low4Bytes= ((long(ord(buffer[0])) & 0x18) >> 3) << 30
@@ -313,6 +316,9 @@
         """
         read SCR (timestamp) for MPEG1 at the buffer beginning (5 Bytes)
         """
+        if len(buffer) < 5:
+            return -1
+
         highbit = (ord(buffer[0]) >> 3) & 0x01
 
         low4Bytes = ((long(ord(buffer[0])) >> 1) & 0x03) << 30

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to