[FFmpeg-devel] [PATCH] dvdsubdec make pos values unsigned

Reimar Döffinger Reimar.Doeffinger
Thu Aug 13 13:25:20 CEST 2009

dvdsubdec reads 32 bit values into e.g. cmd_pos and then checks its
validity with e.g.
while ((cmd_pos + 2 + offset_size) < buf_size) {
which obviously is not correct.
I suggest the simplest fix of making these variables unsigned:
Index: dvdsubdec.c
--- dvdsubdec.c (revision 19613)
+++ dvdsubdec.c (working copy)
@@ -163,7 +163,8 @@
 static int decode_dvd_subtitles(AVSubtitle *sub_header,
                                 const uint8_t *buf, int buf_size)
-    int cmd_pos, pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos;
+    unsigned cmd_pos, pos, next_cmd_pos;
+    int cmd, x1, y1, x2, y2, offset1, offset2;
     int big_offsets, offset_size, is_8bit = 0;
     const uint8_t *yuv_palette = 0;
     uint8_t colormap[4], alpha[256];

More information about the ffmpeg-devel mailing list