Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: src/bit-vector.h

Issue 1124223006: [clusterfuzz] Length 0 is perfectly fine for BitVector. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bit-vector.h
diff --git a/src/bit-vector.h b/src/bit-vector.h
index eeda0e91cb1501a40b3ee80edf5d32ab90d33113..3703f28d91d84813301aebd4ebbcadbbea678a27 100644
--- a/src/bit-vector.h
+++ b/src/bit-vector.h
@@ -66,7 +66,7 @@ class BitVector : public ZoneObject {
: length_(length),
data_length_(SizeFor(length)),
data_(zone->NewArray<uintptr_t>(data_length_)) {
- DCHECK(length > 0);
+ DCHECK_LE(0, length);
Clear();
}
@@ -77,7 +77,10 @@ class BitVector : public ZoneObject {
CopyFrom(other);
}
- static int SizeFor(int length) { return 1 + ((length - 1) / kDataBits); }
+ static int SizeFor(int length) {
+ if (length == 0) return 1;
+ return 1 + ((length - 1) / kDataBits);
+ }
void CopyFrom(const BitVector& other) {
DCHECK(other.length() <= length());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698