Tim Armstrong has posted comments on this change. ( http://gerrit.cloudera.org:8080/10948 )
Change subject: IMPALA-5031: Fix undefined behavior: memset NULL ...................................................................... Patch Set 2: (1 comment) http://gerrit.cloudera.org:8080/#/c/10948/2/be/src/util/ubsan.h File be/src/util/ubsan.h: http://gerrit.cloudera.org:8080/#/c/10948/2/be/src/util/ubsan.h@29 PS2, Line 29: if (s == nullptr) return s; > If DCHECKs are no-ops in release mode, the NULL pointer check will be missi Which suggestion are you referring to? I don't think that problem applies to either alternative I had in mind. if (s == nullptr) { DCHECK_EQ(0, n); return s; } ... or if (n == 0) { return s; } DCHECK(s != nullptr); ... Either case hits the DCHECK on a DEBUG build when there's a bug (n > 0 || s == nullptr) and behaves in a defined way on both release and debug builds when the arguments are valid. -- To view, visit http://gerrit.cloudera.org:8080/10948 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I18fa02dc887a42a94c6f81e4923d17568f2184f2 Gerrit-Change-Number: 10948 Gerrit-PatchSet: 2 Gerrit-Owner: Jim Apple <[email protected]> Gerrit-Reviewer: Jim Apple <[email protected]> Gerrit-Reviewer: Tim Armstrong <[email protected]> Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]> Gerrit-Comment-Date: Tue, 17 Jul 2018 16:46:34 +0000 Gerrit-HasComments: Yes
