Chromium Code Reviews| Index: runtime/vm/bitmap.cc |
| =================================================================== |
| --- runtime/vm/bitmap.cc (revision 23602) |
| +++ runtime/vm/bitmap.cc (working copy) |
| @@ -32,7 +32,9 @@ |
| bool BitmapBuilder::Get(intptr_t bit_offset) const { |
| - ASSERT(InRange(bit_offset)); |
| + if (!InRange(bit_offset)) { |
| + return false; |
| + } |
| intptr_t byte_offset = bit_offset >> kBitsPerByteLog2; |
| // Bits not covered by the backing store are implicitly false. |
| return (byte_offset < data_size_in_bytes_) && GetBit(bit_offset); |
| @@ -47,6 +49,10 @@ |
| if (!value) return; |
| // Grow the backing store if necessary. |
| intptr_t byte_offset = bit_offset >> kBitsPerByteLog2; |
| + if (byte_offset > kSmiMax) { |
| + FATAL1("Fatal error in BitmapBuilder::Set : invalid bit_offset, %"Pd"\n", |
| + bit_offset); |
| + } |
| if (byte_offset >= data_size_in_bytes_) { |
| uint8_t* old_data = data_; |
| intptr_t old_size = data_size_in_bytes_; |
| @@ -72,7 +78,9 @@ |
| bool BitmapBuilder::GetBit(intptr_t bit_offset) const { |
| - ASSERT(InRange(bit_offset)); |
| + if (!InRange(bit_offset)) { |
| + return false; |
| + } |
| intptr_t byte_offset = bit_offset >> kBitsPerByteLog2; |
| ASSERT(byte_offset < data_size_in_bytes_); |
| intptr_t bit_remainder = bit_offset & (kBitsPerByte - 1); |
| @@ -83,7 +91,9 @@ |
| void BitmapBuilder::SetBit(intptr_t bit_offset, bool value) { |
| - ASSERT(InRange(bit_offset)); |
| + if (!InRange(bit_offset)) { |
| + return; |
|
srdjan
2013/06/05 15:57:21
FATAL instead of return
siva
2013/06/05 16:22:09
Done.
|
| + } |
| int byte_offset = bit_offset >> kBitsPerByteLog2; |
| ASSERT(byte_offset < data_size_in_bytes_); |
| int bit_remainder = bit_offset & (kBitsPerByte - 1); |