Properly handle SkipBytes with num_bytes as 0
Previously if there are no bytes remaining, SkipBytes(0) would fail, which results in parsing error in AACAudioSpecificConfig::ParseProgramConfigElement. Fixes #875. Change-Id: I271899a37303d0d3fa0cf1bf90f99227058b82df
This commit is contained in:
parent
d90cf9a0fd
commit
b231c36539
|
@ -61,10 +61,10 @@ void BitReader::SkipToNextByte() {
|
|||
}
|
||||
|
||||
bool BitReader::SkipBytes(size_t num_bytes) {
|
||||
if (num_remaining_bits_in_curr_byte_ != 8)
|
||||
return false;
|
||||
if (num_bytes == 0)
|
||||
return true;
|
||||
if (num_remaining_bits_in_curr_byte_ != 8)
|
||||
return false;
|
||||
|
||||
data_ += num_bytes - 1; // One additional byte in curr_byte_.
|
||||
if (num_bytes > bytes_left_ + 1)
|
||||
|
|
|
@ -70,6 +70,7 @@ TEST(BitReaderTest, SkipBitsTest) {
|
|||
EXPECT_EQ(13, value8);
|
||||
EXPECT_FALSE(reader1.SkipBits(100));
|
||||
EXPECT_TRUE(reader1.SkipBits(0));
|
||||
EXPECT_TRUE(reader1.SkipBytes(0));
|
||||
EXPECT_FALSE(reader1.SkipBits(1));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue