diff options
author | Martin Liska <mliska@suse.cz> | 2017-04-06 15:42:24 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2017-04-06 13:42:24 +0000 |
commit | d9f8c5af8bc43681764923379dc465b62b56877a (patch) | |
tree | bc786c4ef7e28f7d3edd576fc6f983b0029dbabc /libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc | |
parent | 1b68991f4df584c31d976f5a4ece641bcbe6129a (diff) | |
download | gcc-d9f8c5af8bc43681764923379dc465b62b56877a.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.
From-SVN: r246730
Diffstat (limited to 'libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc')
-rw-r--r-- | libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc | 3 |
1 files changed, 2 insertions, 1 deletions
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); |