Fix the use of op + len when op is nullptr and len is non-zero.
See https://reviews.llvm.org/D67122 for some discussion of why this can matter. I don't think this should have any noticeable effect on performance. PiperOrigin-RevId: 340255083
This commit is contained in:
committed by
Victor Costan
parent
0b990db2b8
commit
1ce58af28e
@@ -1569,15 +1569,14 @@ class SnappyScatteredWriter {
|
|||||||
static_cast<size_t>(op - op_base_) < offset ||
|
static_cast<size_t>(op - op_base_) < offset ||
|
||||||
op >= op_limit_min_slop_ || offset < len)) {
|
op >= op_limit_min_slop_ || offset < len)) {
|
||||||
if (offset == 0) return false;
|
if (offset == 0) return false;
|
||||||
char* const op_end = op + len;
|
|
||||||
if (SNAPPY_PREDICT_FALSE(static_cast<size_t>(op - op_base_) < offset ||
|
if (SNAPPY_PREDICT_FALSE(static_cast<size_t>(op - op_base_) < offset ||
|
||||||
op_end > op_limit_)) {
|
op + len > op_limit_)) {
|
||||||
op_ptr_ = op;
|
op_ptr_ = op;
|
||||||
bool res = SlowAppendFromSelf(offset, len);
|
bool res = SlowAppendFromSelf(offset, len);
|
||||||
*op_p = op_ptr_;
|
*op_p = op_ptr_;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
*op_p = IncrementalCopy(op - offset, op, op_end, op_limit_);
|
*op_p = IncrementalCopy(op - offset, op, op + len, op_limit_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Fast path
|
// Fast path
|
||||||
|
|||||||
Reference in New Issue
Block a user