Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-967

io_lib:format/3 can fall into an infinite loop when chars_limit is set

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 22.0, 21.3
    • Fix Version/s: 22.0.3, 21.3.8.4
    • Component/s: stdlib
    • Labels:
      None

      Description

      io_lib:format/3 can fall into an infinite loop when we have nested data structures (probably only with binaries)
      and particular value for chars_limit.

      The infinite loop appears in io_lib_pretty:find_upper/9 when io_lib_pretty:expand/3 starts to return
      same values. Len returned by io_lib_pretty:expand/3 is equal to T which leads to a re-call of io_lib_pretty:find_upper/9.

      I'm not sure that condition Len =< T is wrong. Probably io_lib_pretty:expand/3 or some function inside of has a mistake.

      Example to reproduce error:

      io_lib:format("~tp", [[{0, [<<"00">>]}]], [{chars_limit, 18}]).
      

        Attachments

          Activity

            People

            Assignee:
            hasse Hans Bolinder
            Reporter:
            avitko Aleksandr Vitko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: