buglwIP - A Lightweight TCP/IP stack - Bugs: bug #55607, MQTT assert when length of...


You are not allowed to post comments on this tracker with your current authentication level.

bug #55607: MQTT assert when length of received message > MQTT_VAR_HEADER_BUFFER_LEN

Submitted by:  David GIRAULT <dgirault>
Submitted on:  Wed 30 Jan 2019 10:16:41 AM UTC  
Category:  apps Severity:  3 - Normal
Item Group:  Crash Error Status:  In Progress
Privacy:  Public Assigned to:  Simon Goldschmidt <goldsimon>
Open/Closed:  Open Planned Release:  None
lwIP version:  git head

( Jump to the original submission)

Tue 23 Apr 2019 11:20:15 AM UTC, comment #6:

Hi Simon,

Just had time to rebase over master (ec11b289) and include an additional fix in MQTT for a corner case that appears in our configuration.

See new attached patches.


(file #46816, file #46817)

David GIRAULT <dgirault>
Fri 01 Feb 2019 02:25:33 PM UTC, comment #5:

No problem, I'll do that.

David GIRAULT <dgirault>
Wed 30 Jan 2019 06:18:37 PM UTC, comment #4:

I'd apply it, but that doesn't work. Can you pull and rebase 0002?

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Wed 30 Jan 2019 03:31:09 PM UTC, comment #3:

Arg, I didn't see that you had pushed this bugfix when a added the comment #2.

Do you want I create another bug report for the second patch?

David GIRAULT <dgirault>
Wed 30 Jan 2019 03:03:54 PM UTC, comment #2:

Seen another problem with mqtt_parse_incoming() that may not call mqtt_message_received() if remaining part of current buffer isn't equal to buffer_space!
This is almost all time the case when called from altcp_tls socket.

The second patch address this and additionally allow working mostly in zero-copy mode.

Using a MQTT_VAR_HEADER_BUFFER_LEN of 1520 will allow zero-copy for all received frame (when connected through TLS).

In our architecture, working on pbuf is faster than in `client->rx_buffer` because not in same memory space (SRAM vs. SDRAM).

(file #46134)

David GIRAULT <dgirault>
Wed 30 Jan 2019 01:31:53 PM UTC, comment #1:

Pushed, thanks for the patch!

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Wed 30 Jan 2019 10:16:41 AM UTC, original submission:

The following assert in mqtt.c line 684, added by commit eea95459c9b0f150e9b9ab24e80e27e09c2612e5, completely broke MQTT reception.


MQTT had always the ability to receive message longer than MQTT_VAR_HEADER_BUFFER_LEN. Receive callback is called many times.

David GIRAULT <dgirault>



Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by dgirault (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-04-23 dgirault Attached File- => Added 0002-mqtt-fix-first-packet-checking-which-fail-if-MQTT_VA.patch, #46817
    2019-04-23 dgirault Attached File- => Added 0001-mqtt-support-mostly-zero-copy-message-analysis.patch, #46816
    2019-01-30 goldsimon StatusFixed => In Progress
        Open/ClosedClosed => Open
    2019-01-30 dgirault Attached File- => Added 0002-mqtt-support-mostly-zero-copy-message-analysis.patch, #46134
    2019-01-30 goldsimon StatusNone => Fixed
        Assigned toNone => goldsimon
        Open/ClosedOpen => Closed
    2019-01-30 dgirault Attached File- => Added 0001-mqtt-remove-bad-assert-in-mqtt_message_received.patch, #46133

    Back to the top

    Powered by Savane 3.4