From 8597e538b77e83348d6cea7782765d9267783c0a Mon Sep 17 00:00:00 2001 From: Patrik Nyblom Date: Wed, 20 Jan 2010 10:43:27 +0000 Subject: OTP-8375 A bug causing memory corruption in re:run() has been corrected. (Thanks to Yamashina Hio.) --- erts/emulator/beam/erl_bif_re.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/erts/emulator/beam/erl_bif_re.c b/erts/emulator/beam/erl_bif_re.c index 16abab65b0..6efc19597b 100644 --- a/erts/emulator/beam/erl_bif_re.c +++ b/erts/emulator/beam/erl_bif_re.c @@ -1,19 +1,19 @@ /* * %CopyrightBegin% - * - * Copyright Ericsson AB 2008-2009. All Rights Reserved. - * + * + * Copyright Ericsson AB 2008-2010. All Rights Reserved. + * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in * compliance with the License. You should have received a copy of the * Erlang Public License along with this software. If not, it can be * retrieved online at http://www.erlang.org/. - * + * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. - * + * * %CopyrightEnd% */ @@ -1020,6 +1020,9 @@ re_run_3(BIF_ALIST_3) goto handle_iolist; } pb = (ProcBin *) bptr; + if (pb->flags) { + erts_emasculate_writable_binary(pb); + } restart.subject = (char *) (pb->bytes+offset); restart.flags |= RESTART_FLAG_SUBJECT_IN_BINARY; } else { -- cgit v1.2.3