[erlang-bugs] possible bug with binary pattern matching

Bengt Kleberg bengt.kleberg@REDACTED
Mon Mar 17 09:49:39 CET 2008


Greetings,

On my machine there crash did _not_ happen.

Erlang (BEAM) emulator version 5.5.5.6 [async-threads:0]
[kernel-poll:false]

Linux seasc0625 2.6.16.53-0.16-bigsmp #1 SMP Tue Oct 2 16:57:49 UTC 2007
i686 athlon i386 GNU/Linux


bengt

On Fri, 2008-03-14 at 17:15 -0400, Jean-Marc Prud Homme wrote:
> Hi,
> 
>  
> 
> We are experiencing crashes in the VM that seems to be related with
> binary pattern matching.   It was successfully reproduced on Windows
> XP and Linux Ubuntu 7.10 systems with R12B-0 and R12B-1.   The code
> below was used to reproduce the crash.   It needs to be executed
> several times to produce the crash.   
> 
>  
> 
>  
> 
> Regards,
> 
>  
> 
> Jean-Marc
> 
>  
> 
>  
> 
> - - - - - - - - - - - - - - - - 
> 
>  
> 
> %% Run the test 50 times
> 
> binary_test:run(50).    
> 
>  
> 
>  
> 
> - - - - - - - - - - - - - - - - 
> 
> -module(binary_test).
> 
>  
> 
> -compile(export_all).
> 
>  
> 
> run(N) ->
> 
>     
> 
>     T = <<8,1,9,1,0,8,1,9,1,0,8,1,9,1,0>>,
> 
>  
> 
>     F = fun() -> f1(T, {[test]}) end,
> 
>  
> 
>     repeat(N, F),
> 
>  
> 
>     ok.
> 
>  
> 
> repeat(0, _Fun) ->
> 
>     ok;
> 
>  
> 
> repeat(N, Fun) ->
> 
>     Fun(),
> 
>     repeat(N-1, Fun).
> 
>                
> 
>                                        
> 
> %% 1
> 
> f1(R, T) ->  
> 
>     f2(R, [T]).             
> 
>          
> 
> %% 2
> 
> f2(<<R/binary>>, T) ->      
> 
>    f3(R, {T}).                               
> 
>                                                 
> 
> %% Never called but helps reproducing the crash
> 
> f3(<<L:8, T:L/binary-unit:8>>, a) -> 
> 
>     f4(T);
> 
> f3(<<L:8, T:L/binary-unit:8>>, b) -> 
> 
>     f4(T); 
> 
> f3(<<R/binary>>, c) -> 
> 
>     f4(0); 
> 
>  
> 
> %% 3
> 
> f3(<<R/binary>>, {T}) ->
> 
>     f3(R, T);
> 
>  
> 
> %% 4
> 
> f3(<<L:8, R/binary>>, [_]) ->
> 
>     f4([]);  
> 
>     
> 
> %% Never called but helps reproducing the crash
> 
> f3(<<L:8, T:L/binary-unit:8>>, d) -> 
> 
>     f4(T).    
> 
>                                              
> 
> %% 5    
> 
> f4(T) ->  
> 
>     f5({T}).      
> 
>  
> 
> %% 6       
> 
> f5(T) ->
> 
>     {T}.   
> 
> 
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-bugs




More information about the erlang-bugs mailing list