Fix CRC calculation for small blocks.
authorRobert Kausch <robert.kausch@freac.org>
Mon, 30 Apr 2018 16:09:51 +0000 (18:09 +0200)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Mon, 21 May 2018 00:19:03 +0000 (10:19 +1000)
src/libFLAC/bitreader.c

index 683e9f8..6a41509 100644 (file)
@@ -128,7 +128,7 @@ static inline void crc16_update_word_(FLAC__BitReader *br, brword word)
 
 static inline void crc16_update_block_(FLAC__BitReader *br)
 {
-       if(br->crc16_align)
+       if(br->consumed_words > br->crc16_offset && br->crc16_align)
                crc16_update_word_(br, br->buffer[br->crc16_offset++]);
 
 #if FLAC__BYTES_PER_WORD == 4