summaryrefslogtreecommitdiffstats
path: root/src/vppinfra/serialize.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2023-01-12 16:07:26 -0500
committerFlorin Coras <florin.coras@gmail.com>2023-01-12 23:03:22 +0000
commit809eb669c7a353cd06da58ccdf8578053b1233ca (patch)
tree4fcf4884aeedc116a40a622a27d616fb9681134b /src/vppinfra/serialize.c
parentdcca9e75a17aca6fd83586a4de66fed65ec5d11b (diff)
vppinfra: fix longstanding corner case bug in serialize_get()
serialize_get() -> serialize_write_not_inline(...) was losing track of the current buffer index when it managed to empty the overflow vector but had to turn around and use it again. Test-case added to test_serialize.c. This issue dates from 2010. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I024a03f7a50fd6df543ddbc7c45d85def4f1981d
Diffstat (limited to 'src/vppinfra/serialize.c')
-rw-r--r--src/vppinfra/serialize.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/vppinfra/serialize.c b/src/vppinfra/serialize.c
index f5c00649627..ceda617f872 100644
--- a/src/vppinfra/serialize.c
+++ b/src/vppinfra/serialize.c
@@ -741,6 +741,7 @@ serialize_write_not_inline (serialize_main_header_t * m,
if (n_left_o > 0 || n_left_b < n_bytes_to_write)
{
u8 *r;
+ s->current_buffer_index = cur_bi;
vec_add2 (s->overflow_buffer, r, n_bytes_to_write);
return r;
}