[erlang-patches] Fix error in beam_disasm if no attributes chunk found in beam files

Henrik Nord henrik@REDACTED
Mon Aug 22 16:30:15 CEST 2011


On 07/22/2011 11:39 AM, Haitao Li wrote:
> Hi,
>
> How to reproduce:
>
> $ erl
> 1>  c(abc).
> {ok,abc}
> 2>  beam_lib:strip(abc).
> {ok,{abc,"abc.beam"}}
> 3>  beam_disasm:file(abc).
> {error,beam_disasm,
>         {internal,{{case_clause,{error,beam_lib,
>                                        {missing_chunk,'abc.beam',"Attr"}}},
>                    [{beam_disasm,optional_chunk,2},
>                     {beam_disasm,process_chunks,1},
>                     {beam_disasm,file,1},
>                     {erl_eval,do_apply,5},
>                     {shell,exprs,7},
>                     {shell,eval_exprs,7},
>                     {shell,eval_loop,3}]}}}
>
>
> Patch:
> git fetch git://github.com/lht/otp.git beam-disasm-chunks-badmatch
>
> diff --git a/lib/compiler/src/beam_disasm.erl b/lib/compiler/src/beam_disasm.erl
> index 017ca12..9df10e9 100644
> --- a/lib/compiler/src/beam_disasm.erl
> +++ b/lib/compiler/src/beam_disasm.erl
> @@ -182,7 +182,7 @@ process_chunks(F) ->
>              Literals = beam_disasm_literals(LiteralBin),
>              Code = beam_disasm_code(CodeBin, Atoms, mk_imports(ImportsList),
>                                      StrBin, Lambdas, Literals, Module),
> -           Attributes = optional_chunk(F, attributes),
> +           Attributes = optional_chunk(F, "Attr"),
>              CompInfo =
>                  case optional_chunk(F, "CInf") of
>                      none ->  none;
>
> Haitao
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches
I have included your branch in 'pu'

also, can we have a test for this?

Thank you for the contribution

-- 
/Henrik Nord Erlang/OTP




More information about the erlang-patches mailing list