# HG changeset patch # User michaelni # Date 1038300970 0 # Node ID 550033bc7e2d4182f1fe37cb75e4a279eafda43f # Parent d3fc77a6d57e8ecb4eef2917369c34feb6d5ce55 fixing h263+ slices if the padding at the end of the frame is >7 && <16 && there are no zero bytes afterwards diff -r d3fc77a6d57e -r 550033bc7e2d h263.c --- a/h263.c Tue Nov 26 04:29:40 2002 +0000 +++ b/h263.c Tue Nov 26 08:56:10 2002 +0000 @@ -3292,14 +3292,14 @@ return SLICE_END; } }else{ - if(get_bits_count(&s->gb) + 7 >= s->gb.size*8){ - int v= show_bits(&s->gb, 8) >> (((get_bits_count(&s->gb)-1)&7)+1); - if(v==0) - return SLICE_END; - }else{ - if(show_bits(&s->gb, 16)==0) - return SLICE_END; + int v= show_bits(&s->gb, 16); + + if(get_bits_count(&s->gb) + 16 > s->gb.size*8){ + v>>= get_bits_count(&s->gb) + 16 - s->gb.size*8; } + + if(v==0) + return SLICE_END; } return SLICE_OK;