[erlang-patches] Fix bug in argument checking in binary:matches/2

Mike Sassak msassak@REDACTED
Sat Sep 21 04:35:12 CEST 2013


Hi erlang-patches,

Including an empty binary as one of multiple patterns to binary:matches/2
crashes BEAM:

    binary:matches(<<"foo">>, [<<>>, <<"f">>]). % -> Crash

Passing just an empty binary, or a list containing only the empty binary
throws a badarg as expected:

    binary:matches(<<"foo">>, <<>>) % -> badarg
    binary:matches(<<"foo">>, [<<>>]) % -> badarg

My patch ensures all patterns passed to binary:matches/2 are checked for
validity and throws badarg if one is not valid.

You can fetch the patch with:

    git fetch git://github.com/msassak/otp.git empty-pattern-badarg

And check out diff views here:


https://github.com/msassak/otp/compare/erlang:maint...empty-pattern-badarg

https://github.com/msassak/otp/compare/erlang:maint...empty-pattern-badarg.patch

Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20130920/f3e39f9c/attachment.htm>


More information about the erlang-patches mailing list