Skip to content

WiFiUDP.parseInt - Infinite Loop/WDT Reset - V2.2.0 (See #1796) #1946

Closed
@AllanMar

Description

@AllanMar

It appears as though the fix for #1796 did not solve the issue.
I couldn't understand originally why, as it appears to just be a different method of doing what I had suggested.

Upon further investigation the issue is here:

char peek()
    {
        if (!_rx_buf || _rx_buf_offset == _rx_buf->len)
            return -1;

        return reinterpret_cast<char*>(_rx_buf->payload)[_rx_buf_offset];
    }

It appears in ESP8266 toolchain (like ARM, but unlike AVR) char defaults to UNSIGNED. Which means it never returns -1 and results in infinite loops elsewhere in the code (parseInt in this case).

  • Shouldn't peek be an int (consistent with read)?
  • Should ESP8266 Arduino use -fsigned-char to default chars to signed?
  • just define peek as signed char? (my current workaround)

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions