[erlang-bugs] Potential bug in OTP_17.0-rc1 when converting map to binary and back

Gustav Simonsson <>
Sat Feb 1 18:41:15 CET 2014


Hi,

After the announcement of OTP_17.0-rc1 I compiled the source and started
playing with maps and proper.

After testing a bunch of stuff like maps:to_list(maps:from_list(List)) I
replicated a classic proper example to verify
binary_to_term(term_to_binary(T)).

========================================
========================================

-module(t).
-include_lib("proper/include/proper.hrl").
-compile([export_all]).

prop_term_binary() ->
    ?FORALL(T,
            term(),
            T =:= binary_to_term(term_to_binary(T))
           ).

========================================
========================================

proper:quickcheck(t:prop_term_binary(), [{numtests, 10000}]).

(alot of dots ...)

OK: Passed 10000 test(s).

All is well.

Then, I created this property:

prop_maps2() ->
    ?FORALL({PL},
            {list({term(), term()})},
            begin
                PropList1 = lists:ukeysort(1, PL),
                Map1 = maps:from_list(PropList1),
                Map1 =:= binary_to_term(term_to_binary(Map1))
            end
           ).

========================================
========================================

18:33:05 batman ~/projects/erl_maps> erl
Erlang/OTP 17 [RELEASE CANDIDATE 1] [erts-6.0] [source-fdcdaca] [64-bit]
[smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V6.0  (abort with ^G)
1> c(t).
{ok,t}
2>  proper:quickcheck(t:prop_maps2(), [{numtests, 10000}]).
.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................!
Failed: After 4066 test(s).
{[{[-3.916167101796315,5,-14.383620880842821,25,-11,-5,4,-10.251333004157411,-80,21,-11.9643845075958,-10,-16,-5,'\005±V´\027>T¦À23õ®nÍ',-4,<<229>>],6},{<<105,172,229,134,160,163,53,135,179,161,236,42,39,31:5>>,{-11.676717778419862,17.707585198254716,33,'\206\003-f\f\003Ã\236R',<<192,123,148,228,7:3>>,[],{[]},-9,-7,-6,{9,'\200m÷',<<1:3>>,{},3.823878214590697},-20.191151612002688}},{-8,<<97,213,88,122,106,212,110,126,3:2>>},{[[[],[],14.928837856623751,{}],{},[]],{'\222ÿ&ñ\203\204\217¦\000u\206Î\235!m',-19.469218108368914,'',[],{[10.946799426461407,[[-3.6593067623424336]],[],'¢~\225\né\207m\\'],[{}]},-56,-1.7371040930562214,3,9,-2,'\037Eå8ê,ªàÒª@Ñ@¾U\221ÿÕ','µ)\004?¸ÁFÛ',[]}},{<<112,8:4>>,'PÎB\026\032zE:À\230d'},{20,'UÈ%V÷­'},{{8,-5,'À[÷m\206ÑY(\023\002â\200\201\f',5.860510875770583,-11.499743607476358,-14,78.9417958106197,23,-32},[]},{78.81062902366494,[16,'\n¬\'ó9OÏ¡ÒÛ\d',20,-28.505106763693114,'È\232Ñ`îkB·º\035òÐØ',9.491181213276489,-4.446055020279977,2,'Íþ','ü§Í)ÚQ\026g',[],{22,[-49.87040520039398,{},20,'(´«A\037¸\v\203\031(M"¿áHí']},'ü}íÉ^',-190.16730030976382,{},-9]},{{-2,9,-15,'Û\212m?\017\227',130,7.406083792942151,47.91530575448283,17,-56,-27,1.1696130495141,8,<<10,97,84,1,210,239,179,245,75,99,204,64,4:3>>,'','\024û¿\020b¯\201>L'},{20,-8.728673595127718,5.131028941847757,{},-22.264422165841957,[[]]}},{-0.805323038965695,['ãt]\002úBûõª]\236\207Jq&Gk',-23,'íé\232{\016Í´g\016Åßõ\017Ò\036õß\t','»ç',-23.674996673031742,3,5.511692289051506,-14,-18.02109289321752,0.7818131441815134]},{{[11.68346635783379,'ýÞ\225\032\232Ã
,Á|\022
\205L\205',0,[{<<123:7>>}],-2.4217323982351866,1.1404903952928618,{[{}],{},'¤nú\032Ù\bÁ+\e
<;¦fÉÖÇ'},12.184525559260809,-10.00845000093209,-13,[56],{}],'ê´',-4,26.708298789331433,4,<<255,6,0:1>>,'÷',10,2.3535448113644706,'Ï',-112.15429185940658,4.322599970691285,20.556338272619058},{[-9.047222745894432,-6,[]]}},{{-10.004049310388854,'U','4p{JÒkÚpµ\235',24,'ä¾Gæî\034\020Ãî','È´qb8Oǽ\b\220',-19,-45.108220054002054,'[q\022\fx\t\037a\005xõ',-15,2.9443008897224243,<<4,150,219,33,213,112,8,171,0,154,124,45:7>>,-12.217387380533854,'\r@
'},{{{{}},{},0.9613990232005811,['.O\003\017ã&õ\txB-DV´áô',{}]},-5,7,-9,[{}],'[¯¥\222;\205\r7ô,6)ÉI\222Ø[','\213þÛxDp¹',2,22,-62.085919420904354}},{[5,<<142,163,209,185,37,35:6>>,{'ºå\213äí',{[],[],<<173,3:2>>},'',[]},-18.799834786170464],10.169565402950454}]}

Shrinking .......Segmentation fault (core dumped)

========================================
========================================

Erlang version: git tag OTP_17.0-rc1
OS: Ubuntu server 13.10
Arch: Intel(R) Core(TM) i7-3770T

Please let me know if you need a core and/or more details.
It should be easy to replicate given the above code though on various archs.

Cheers,
Gustav Simonsson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140201/7fd0d6b7/attachment-0001.html>


More information about the erlang-bugs mailing list