Fix bug in bitreader handling of read callback returning a short count (SF#2490454: https://sourceforge.net/tracker2/?func=detail&aid=2490454&group_id=13478&atid=113478)

This commit is contained in:
Josh Coalson
2009-01-06 17:14:31 +00:00
parent 0915a551eb
commit ee51fc0bae
3 changed files with 12 additions and 10 deletions

View File

@@ -272,10 +272,11 @@ cident FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap
;; edi uval
;; ebp br
mov edx, [ebp + 12] ; edx <- br->bytes
test edx, edx
jz .read1 ; if(br->bytes) { [NOTE: this case is rare so it doesn't have to be all that fast ]
shl edx, 3 ; edx <- br->bytes*8
cmp edx, ecx
jbe .read1 ; if(br->bytes*8 > cbits) { [NOTE: this case is rare so it doesn't have to be all that fast ]
mov ebx, [ebp]
shl edx, 3 ; edx <- const unsigned end = br->bytes * 8;
; edx <- const unsigned end = br->bytes * 8;
mov eax, [ebx + 4*esi] ; b = br->buffer[cwords]
xchg edx, ecx ; [edx <- cbits , ecx <- end]
mov ebx, 0xffffffff ; ebx <- FLAC__WORD_ALL_ONES
@@ -296,7 +297,7 @@ cident FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap
.c1_next3: ; } else {
sub edi, ecx
add edi, edx ; uval += end - cbits;
add ecx, edx ; cbits += end
mov ecx, edx ; cbits = end
; /* didn't find stop bit yet, have to keep going... */
; }
; }