[erlang-patches] re:run sometimes executed on corrupted data

YAMASHINA Hio hio@REDACTED
Thu Jan 7 12:31:10 CET 2010


Hi.

I get reproduable code for this problem.
Attached is this one.

$ ./bin/erl -noshell -run test start 1000 1986 -run init stop
ret = {match,[<<"4">>]}
<<"1234567890xxxxxxxxxxxxxxxxxxxxxx">> is <matched> with "[\\0\\x01]"
$ git log -1
commit fbdeb03d3919b096e039302801e2e865267a6943
Author: Björn Gustavsson <bjorn@REDACTED>
Date:   Wed Jan 6 10:44:01 2010 +0000

    Update preloaded files


And create git branch:

  git fetch git://github.com/hio/otp.git fix_re_run_corruption


Following note is also written in attached file.
%
% $ ./bin/erl -noshell -run test start 1000 1986 -run init stop
%
% First parameter (Mem=1000) is memory amount to be fat up.
% Second parameter (Reds=1986) is reductions to interrupt erts_pcre_exec().
% Paramter values are maybe depended on running system.
% Your system may need another values.
%
% Above values are appropriate for my environment: 
%   Erlang R13B04 (erts-5.7.5) [source] [64-bit] [smp:4:4] [rq:4]
%   [async-threads:0] [kernel-poll:false]
%
% Mem parameter increases MSO(_p).overhead and this causes garbage collection
% at POST_BIF_GC_SWAPIN.
%
% Reds paramter is passed to erlang:bump_reductions/1 before re:run/3.
% Appropriate value is ERTS_BIF_REDS_LEFT(BIF_P)-1 at just before
% calling erts_pcre_exec() at erl_bif_re.c.


Thank you.

On Mon, 4 Jan 2010 13:19:02 +0100
Björn Gustavsson <bgustavsson@REDACTED> wrote:

> On Thu, Dec 24, 2009 at 9:33 AM, YAMASHINA Hio <hio@REDACTED> wrote:
> > Following snnipet
> >
> >  case re:run(Data, "[\\x00\\x01]", [{capture,[0],binary}]) of
> >  nomatch ->
> >    ok;
> >  {match,X} ->
> >    throw({"source text", Data, "contains invalid sequence", X})
> >  end,
> >
> > rarely raises strange excepion
> >
> >  {"source text",<<"xxx!x">>,"contains invalid sequence",[<<"!">>]}
> 
> Thanks for the bug report and patch. We will investigate the problem.
> 
> 
> If you plan to send more patches, please read our patch submission
> guidelines:
> 
> http://wiki.github.com/erlang/otp/submitting-patches
> 
> -- 
> Björn Gustavsson, Erlang/OTP, Ericsson AB


-- 
YAMASHINA Hio <hio@REDACTED>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.erl
Type: application/octet-stream
Size: 2178 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20100107/b7530021/attachment.obj>


More information about the erlang-patches mailing list