aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-12-11 19:43:19 +0100
committerSverker Eriksson <[email protected]>2013-12-11 19:45:07 +0100
commit289f77ff40833b8b95331efddeaaf29d1af21bae (patch)
tree5452ac48c9ffdf4ed7f67f0cb79bc809351a7b5a
parent6d22d78204ca8bc8ed4beb92f6021ff3ba93a882 (diff)
downloadotp-289f77ff40833b8b95331efddeaaf29d1af21bae.tar.gz
otp-289f77ff40833b8b95331efddeaaf29d1af21bae.tar.bz2
otp-289f77ff40833b8b95331efddeaaf29d1af21bae.zip
erts: Fix valgrind warning for re_SUITE:error_handling
by making sure we at least can read the first four bytes of a compiled regexp where the 'magic_number' is located.
-rw-r--r--erts/emulator/beam/erl_bif_re.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/erts/emulator/beam/erl_bif_re.c b/erts/emulator/beam/erl_bif_re.c
index 99c31738a5..448c6f6f6d 100644
--- a/erts/emulator/beam/erl_bif_re.c
+++ b/erts/emulator/beam/erl_bif_re.c
@@ -1196,8 +1196,8 @@ re_run(Process *p, Eterm arg1, Eterm arg2, Eterm arg3)
ovsize = 3*(unsigned_val(tp[2])+1);
code_size = binary_size(tp[5]);
- if ((code_tmp = (const pcre *)
- erts_get_aligned_binary_bytes(tp[5], &temp_alloc)) == NULL) {
+ code_tmp = (const pcre *) erts_get_aligned_binary_bytes(tp[5], &temp_alloc);
+ if (code_tmp == NULL || code_size < 4) {
erts_free_aligned_binary_bytes(temp_alloc);
BIF_ERROR(p, BADARG);
}