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

Henrik Nord henrik@REDACTED
Mon Sep 23 09:35:52 CEST 2013


On 2013-09-21 04:35, Mike Sassak wrote:
> 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 
> <http://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
>
>
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches
Hi Mike!

I have created a pull request from your patch.
Thank you for your contribution!

-- 
/Henrik Nord Erlang/OTP

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


More information about the erlang-patches mailing list