From 2ccb45c33aecd8b15000c0c622f45eb119b6b478 Mon Sep 17 00:00:00 2001 From: Chris Mumford Date: Mon, 15 Apr 2019 15:11:03 -0700 Subject: [PATCH] Check for possibly invalid offset in test. Fix a possible array bounds offset issue flagged in issue #668. Not the source of any known bug, but will silence any static analyzers. PiperOrigin-RevId: 243697659 --- table/table_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/table/table_test.cc b/table/table_test.cc index e47db3d..5573be6 100644 --- a/table/table_test.cc +++ b/table/table_test.cc @@ -119,7 +119,7 @@ class StringSource: public RandomAccessFile { virtual Status Read(uint64_t offset, size_t n, Slice* result, char* scratch) const { - if (offset > contents_.size()) { + if (offset >= contents_.size()) { return Status::InvalidArgument("invalid Read offset"); } if (offset + n > contents_.size()) {