[MPlayer-cvslog] r38391 - trunk/libmpdemux/mpeg_hdr.c

reimar subversion at mplayerhq.hu
Sat Aug 27 11:07:11 EEST 2022


Author: reimar
Date: Sat Aug 27 11:07:11 2022
New Revision: 38391

Log:
mpeg_hdr.c: Fix unescape code.

For escape codes near the end of the buffer it would
produce incorrect results.
Fixes trac issue #2406.

Modified:
   trunk/libmpdemux/mpeg_hdr.c

Modified: trunk/libmpdemux/mpeg_hdr.c
==============================================================================
--- trunk/libmpdemux/mpeg_hdr.c	Fri Aug 26 23:22:36 2022	(r38390)
+++ trunk/libmpdemux/mpeg_hdr.c	Sat Aug 27 11:07:11 2022	(r38391)
@@ -374,9 +374,9 @@ static int mp_unescape03(uint8_t *dest,
     return 0;
 
   j = i = skip = 0;
-  while(i <= len-3)
+  while(i < len)
   {
-    if(buf[i] == 0 && buf[i+1] == 0 && buf[i+2] == 3)
+    if(i <= len-3 && buf[i] == 0 && buf[i+1] == 0 && buf[i+2] == 3)
     {
       dest[j] = dest[j+1] = 0;
       j += 2;
@@ -390,8 +390,6 @@ static int mp_unescape03(uint8_t *dest,
       i++;
     }
   }
-  dest[j] = buf[len-2];
-  dest[j+1] = buf[len-1];
   len -= skip;
 
   return len;


More information about the MPlayer-cvslog mailing list