Commit d905b5dc authored by Daniel McArdle's avatar Daniel McArdle Committed by Commit Bot

Delete tautologous pointer CHECKs in BigEndianReader/BigEndianWriter.

The constructors for BigEndianReader and BigEndianWriter currently check
that |ptr_ <= end_|. Given that |end_| was constructed from |ptr_| plus
an unsigned length and that the constructors' inputs must correspond to
a valid buffer, CHECK_LE(ptr_, end_) can never fail.

Bug: 1114803
Change-Id: I9ae6c454e28967b036a8e1343d8e9a4cba166cdd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2350151Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797029}
parent 13228911
......@@ -12,9 +12,7 @@
namespace base {
BigEndianReader::BigEndianReader(const char* buf, size_t len)
: ptr_(buf), end_(ptr_ + len) {
CHECK_LE(ptr_, end_);
}
: ptr_(buf), end_(ptr_ + len) {}
bool BigEndianReader::Skip(size_t len) {
if (len > remaining())
......@@ -88,9 +86,7 @@ bool BigEndianReader::ReadU16LengthPrefixed(base::StringPiece* out) {
}
BigEndianWriter::BigEndianWriter(char* buf, size_t len)
: ptr_(buf), end_(ptr_ + len) {
CHECK_LE(ptr_, end_);
}
: ptr_(buf), end_(ptr_ + len) {}
bool BigEndianWriter::Skip(size_t len) {
if (len > remaining())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment