Adar Dembo has submitted this change and it was merged. (
http://gerrit.cloudera.org:8080/14585 )
Change subject: gutil/strings: fix UBSAN error in FindNth
......................................................................
gutil/strings: fix UBSAN error in FindNth
UBSAN complains when we overflow an unsigned type (size_t). It's not
undefined behavior, but UBSAN's position is that these kinds of overflows
are often unintentional and signal a bug.
Newer versions of the code (in other Google codebases) address the problem
by using an int instead of size_t, so we'll do the same thing too.
src/kudu/gutil/strings/util.cc:1030:34: runtime error: unsigned integer
overflow: 18446744073709551615 + 1 cannot be represented in type 'unsigned long'
#0 0x7fcee8a0798e in FindNth(StringPiece, char, int)
/src/kudu/gutil/strings/util.cc:1030:34
Change-Id: I00a36f999a8c3b13469600b785da95c487643d4a
Reviewed-on: http://gerrit.cloudera.org:8080/14585
Reviewed-by: Alexey Serbin <[email protected]>
Tested-by: Adar Dembo <[email protected]>
---
M src/kudu/gutil/strings/string_util-test.cc
M src/kudu/gutil/strings/util.cc
2 files changed, 11 insertions(+), 1 deletion(-)
Approvals:
Alexey Serbin: Looks good to me, approved
Adar Dembo: Verified
--
To view, visit http://gerrit.cloudera.org:8080/14585
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I00a36f999a8c3b13469600b785da95c487643d4a
Gerrit-Change-Number: 14585
Gerrit-PatchSet: 4
Gerrit-Owner: Adar Dembo <[email protected]>
Gerrit-Reviewer: Adar Dembo <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Andrew Wong <[email protected]>