esp-idf/components/esp_ringbuf
Sudeep Mohanty c6134337a6 ringbuf: Fix bug where comparision between a signed and unsigned operand resulted in incorrect free size for no-split/allow-split buffers
This commit fixes a bug in no-split and allow-split ring buffers free buffer size calculation.
When the free size available in the buffers less than the size of one item header,
the function prvGetCurMaxSizeNoSplit/AllowSplit() incorrectly returned the maxItemSize instead of 0.
This is due to the comparision between a negative and a positive value
where both operands are treated as unsigned during the comparision operation,
thereby treating the negative operand as a large integer.

Also added new unit tests to test buffer-full and almost-full conditions
where this scenario is likely to be hit.

Closes https://github.com/espressif/esp-idf/issues/7344
Closes https://github.com/espressif/esp-idf/pull/7371
2021-12-27 15:14:17 +08:00
..
include/freertos ringbuf: Remove deprecated RingbufferType_t 2019-09-13 09:44:07 +10:00
test ringbuf: Fix bug where comparision between a signed and unsigned operand resulted in incorrect free size for no-split/allow-split buffers 2021-12-27 15:14:17 +08:00
CMakeLists.txt components: use new component registration api 2019-06-21 19:53:29 +08:00
component.mk tools: implement linker script generation 2018-11-16 12:42:02 +08:00
linker.lf ldgen: update component linker fragment files 2019-04-04 15:57:34 +08:00
ringbuf.c ringbuf: Fix bug where comparision between a signed and unsigned operand resulted in incorrect free size for no-split/allow-split buffers 2021-12-27 15:14:17 +08:00