summaryrefslogtreecommitdiff
path: root/libsanitizer
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2017-04-06 13:42:24 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2017-04-06 13:42:24 +0000
commitca23873aed881901a967372e61ee64634d634970 (patch)
treebc786c4ef7e28f7d3edd576fc6f983b0029dbabc /libsanitizer
parentc2d7880c3569dfe94ad93409b206e1824b6da999 (diff)
downloadgcc-ca23873aed881901a967372e61ee64634d634970.tar.gz
Cherry-pick upstream r299036 from libsanitizer (PR sanitizer/80166).
2017-04-06 Martin Liska <mliska@suse.cz> PR sanitizer/80166 * sanitizer_common/sanitizer_common_interceptors.inc (INTERCEPTOR): Cherry-pick upstream r299036. 2017-04-06 Martin Liska <mliska@suse.cz> PR sanitizer/80166 * gcc.dg/asan/pr80166.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246730 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libsanitizer')
-rw-r--r--libsanitizer/ChangeLog6
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc3
2 files changed, 8 insertions, 1 deletions
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index 1beb8d58321..106e168007c 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-06 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/80166
+ * sanitizer_common/sanitizer_common_interceptors.inc (INTERCEPTOR):
+ Cherry-pick upstream r299036.
+
2017-03-22 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/78158
diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
index 0970eda5ee6..195014022a0 100644
--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
@@ -3350,7 +3350,8 @@ INTERCEPTOR(int, getgroups, int size, u32 *lst) {
// its metadata. See
// https://github.com/google/sanitizers/issues/321.
int res = REAL(getgroups)(size, lst);
- if (res && lst) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, lst, res * sizeof(*lst));
+ if (res >= 0 && lst && size > 0)
+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, lst, res * sizeof(*lst));
return res;
}
#define INIT_GETGROUPS COMMON_INTERCEPT_FUNCTION(getgroups);