[erlang-bugs] beam_validator does not validate against circularity in constructed values

Erik Søe Sørensen ess@REDACTED
Mon Jun 27 11:00:48 CEST 2011


The following function passes beam_validator verification, but 
constructs a recursive data structure:

    {module, beamtoying4}.  %% version = 0
    {exports, [{module_info,0},{module_info,1},{recdata,1}]}.
    {labels, 2}.
    {function, recdata, 1, 2}.
      {label,1}.
        {func_info,{atom,beamtoying4},{atom,recdata},1}.
      {label,2}.
        {test_heap,3,1}.
        {put_tuple,2,{x,1}}.
        {put,{x,0}}.
        {put,{x,1}}.
        {move,{x,1},{x,0}}.
        return.

Demo:

    erik@REDACTED:q$ erlc beamtoying4.S
    erik@REDACTED:q$ erl
    Erlang R14B (erts-5.8.1) [source] [64-bit] [smp:8:8] [rq:8]
    [async-threads:0] [kernel-poll:false]

    Eshell V5.8.1  (abort with ^G)
    1> beamtoying4:recdata(x).
    {x,
     {x,{x,{x,{x,{x,{x,{x,{x,{x,{x,{x,{x,{x,{x,...}}}}}}}}}}}}}}}

(The REPL is then stuck.)

Regards,
Erik Søe Sørensen



More information about the erlang-bugs mailing list