diff options
author | Anthony Ramine <[email protected]> | 2014-05-20 22:01:19 +0200 |
---|---|---|
committer | Anthony Ramine <[email protected]> | 2014-05-20 22:01:19 +0200 |
commit | a10a7979887403ea61c30155cef18aa7324420a6 (patch) | |
tree | 98809c4a3550c82f2685053edf892e8d1be473ce /lib/stdlib/src | |
parent | e7e750a40ff875e6d62f1e7904470222ac8de269 (diff) | |
download | otp-a10a7979887403ea61c30155cef18aa7324420a6.tar.gz otp-a10a7979887403ea61c30155cef18aa7324420a6.tar.bz2 otp-a10a7979887403ea61c30155cef18aa7324420a6.zip |
Properly handle fields too short in io_lib_format
Values for which the precision or field width were too small in io_lib_format
could trigger an infinite loop or crash in term/5.
Reported-by: Richard Carlsson
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/io_lib_format.erl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/stdlib/src/io_lib_format.erl b/lib/stdlib/src/io_lib_format.erl index 56e15a17ec..89ae6fb187 100644 --- a/lib/stdlib/src/io_lib_format.erl +++ b/lib/stdlib/src/io_lib_format.erl @@ -255,7 +255,7 @@ term(T, none, _Adj, none, _Pad) -> T; term(T, none, Adj, P, Pad) -> term(T, P, Adj, P, Pad); term(T, F, Adj, P0, Pad) -> L = lists:flatlength(T), - P = case P0 of none -> erlang:min(L, F); _ -> P0 end, + P = erlang:min(L, case P0 of none -> F; _ -> min(P0, F) end), if L > P -> adjust(chars($*, P), chars(Pad, F-P), Adj); |