[erlang-bugs] io_lib format infinite loop

Anthony Ramine n.oxyde@REDACTED
Tue May 20 22:06:12 CEST 2014


Hello,

Here is the fix:

	https://github.com/erlang/otp/pull/376

I also fixed another related bug while I was at it:

1> io_lib_format:fwrite("~2.5w", [3.14]).
** exception error: no true branch found when evaluating an if expression
     in function  io_lib_format:term/5 (io_lib_format.erl, line 259)
     in call from io_lib_format:build/3 (io_lib_format.erl, line 150)

Regards,

-- 
Anthony Ramine

Le 20 mai 2014 à 16:32, Anthony Ramine <n.oxyde@REDACTED> a écrit :

> Found a fix, will submit it later with a test.
> 
> -- 
> Anthony Ramine
> 
> Le 20 mai 2014 à 16:23, Anthony Ramine <n.oxyde@REDACTED> a écrit :
> 
>> Bug is in io_lib_format:term/5 when {4,2,3} = {lists:flatlength(T),F,P0}.
>> 
>> -- 
>> Anthony Ramine
>> 
>> Le 20 mai 2014 à 14:50, Richard Carlsson <carlsson.richard@REDACTED> a écrit :
>> 
>>> Here's a fun one:
>>> 
>>>   1> io:format("~3.3w",[3.14]).
>>>   ***ok
>>>   2> io:format("~2.3w",[3.14]).
>>> 
>>>   BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
>>>          (v)ersion (k)ill (D)b-tables (d)istribution
>>>   ^C
>>> 
>>> And this would be bad to run on a production machine:
>>> 
>>>   1> error_logger:format("~3.3w",[3.14]).
>>>   ok
>>>   =ERROR REPORT==== 20-May-2014::14:38:25 ===
>>>   ***
>>>   2> error_logger:format("~2.3w",[3.14]).
>>>   ok
>>>   3> 
>>> 
>>> (since the formatting is performed by the receiving io server process, the shell remains useful in this case, but the logger becomes locked in an infinite loop consuming all available memory).
>>> 
>>>       /Richard
>>> 
>>> _______________________________________________
>>> erlang-bugs mailing list
>>> erlang-bugs@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-bugs
>> 
> 




More information about the erlang-bugs mailing list