cdgraphics: fix incorrect vertical offset mask in cdg_scroll()
authorXi Wang <xi.wang@gmail.com>
Wed, 14 Nov 2012 08:42:37 +0000 (03:42 -0500)
committerAnton Khirnov <anton@khirnov.net>
Wed, 21 Nov 2012 13:35:26 +0000 (14:35 +0100)
The vertical offset mask 0x07 is suspicious.

    v_off = FFMIN(data[2] & 0x07, CDG_BORDER_HEIGHT - 1);

Note that v_off is up to 11 (CDG_BORDER_HEIGHT - 1), the correct mask
should be 0x0F.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavcodec/cdgraphics.c

index 21de07e..631c415 100644 (file)
@@ -218,7 +218,7 @@ static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
     vscmd = (data[2] & 0x30) >> 4;
 
     h_off =  FFMIN(data[1] & 0x07, CDG_BORDER_WIDTH  - 1);
-    v_off =  FFMIN(data[2] & 0x07, CDG_BORDER_HEIGHT - 1);
+    v_off =  FFMIN(data[2] & 0x0F, CDG_BORDER_HEIGHT - 1);
 
     /// find the difference and save the offset for cdg_tile_block usage
     hinc = h_off - cc->hscroll;