Anonymous
Not applicable
May 27, 2013
10:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 27, 2013
10:13 PM
[SDK-2.3.1]There seems to be a bug in wiced_packet_get_data, where data_length is assigned the length of the entire packets netbuf, rather than individual contiguous pbuf:
*data_length = packet->p->tot_len;...*data_length = (uint16_t)(*data_length - offset);E.g., if I have a netbuf of 2 pbufs of 5 bytes, and read at offset 0:
data_length = 10available_length = 10data = ... pbuf (5 bytes)So I will read past the end of data if I try to read more than 5 bytes.I think the initial value should be the length of the current pbuf:
*data_length = packet->p->len;...*data_length = (uint16_t)(*data_length - offset);So same read at 0 would be:
data_length = 5available_length = 10data = ... pbuf (5 bytes)
Labels
- Labels:
-
SPI
- Tags:
- affecting
- assert
- assumes
- buffers
- chained
- change
- code
- equal
- existing
- fact
- feedback
- functionality
- future
- internal
- issue
- lwip
- means
- p-len
- p-tot_len
- packet
- places
- prepared
- raised
- review
- support
- supporting
- tot_len
- version
- wiced
- wiced_packet_get_data
5 Replies
Anonymous
Not applicable
Jun 03, 2013
05:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 03, 2013
05:33 PM
WICED does not officially support chained buffers and using them will cause unpredictable behaviour.
Anonymous
Not applicable
Jun 21, 2013
06:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 21, 2013
06:16 PM
packet->p always points the top of pBuf memory chain.packet->ptr points the current node of pBuf memory chain.*data_length requires current nodes memory size.So, I think
*data_length = packet->p->tot_len;should be
*data_length = packet->ptr->len;
Anonymous
Not applicable
Jun 23, 2013
11:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 23, 2013
11:22 PM
WICED currently does not support chained packet buffers and much of the code assumes that tot_len and len are equal. In fact there are places that assert that p->tot_len == p->len.That means we can change from using tot_len to len without affecting existing functionality but allows WICED to be better prepared for supporting chained packet buffers in the future.An internal issue has been raised to review our use of tot_len and len.Thank you for your feedback
Anonymous
Not applicable
Nov 08, 2013
01:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 08, 2013
01:03 PM
WICED currently does not support chained packet buffers and so much of the code assumes that tot_len and len are equal. In fact there are places that assert that p->tot_len == p->len.That means we can change from using tot_len to len without affecting existing functionality but allows WICED to be better prepared for supporting chained packet buffers in the future.An internal issue has been raised to review our use of tot_len and len.Thank you for your feedbackYou are referring to the internals of the LWIP netbuf, but does this mean that at the WICED API level:1. calling wiced_tcp_receive() today always returns wiced packet with a single contiguous buffer?2. passing this packet to wiced_packet_get_data will always return a pointer to this single buffer, and both the data_length and available_data_length will be the same, equal to the received amount of data in this packet?
Anonymous
Not applicable
Nov 11, 2013
08:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 11, 2013
08:20 PM
1. Yes2. Yes