Skip to content

Commit 7b87bbb

Browse files
committed
log_event_decoder: add tests for group marker skipping with corrupted data
Add comprehensive test coverage for group marker skipping when read_groups is disabled, including: - Normal group marker skipping (GROUP_START/END properly matched) - Unmatched GROUP_START markers - Unmatched GROUP_END markers - Multiple consecutive group markers - Mixed invalid group sequences - Buffers containing only group markers These tests verify that the decoder: 1. Correctly skips group markers when read_groups=false 2. Returns all normal log records in order 3. Never returns zeroed events 4. Handles corrupted/malformed group data gracefully 5. Doesn't crash on invalid group sequences Also improve code documentation explaining that msgpack_unpack_next handles reinitialization internally, so explicit cleanup isn't needed in the recursive call path. Signed-off-by: Eduardo Silva <[email protected]>
1 parent 311d930 commit 7b87bbb

File tree

2 files changed

+443
-0
lines changed

2 files changed

+443
-0
lines changed

src/flb_log_event_decoder.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,11 @@ int flb_log_event_decoder_next(struct flb_log_event_decoder *context,
407407
}
408408

409409
if (context->read_groups != FLB_TRUE) {
410+
/*
411+
* Skip group markers by recursively calling to get next record.
412+
* msgpack_unpack_next will properly destroy and reinitialize
413+
* unpacked_event, so no explicit cleanup needed here.
414+
*/
410415
memset(event, 0, sizeof(struct flb_log_event));
411416
return flb_log_event_decoder_next(context, event);
412417
}

0 commit comments

Comments
 (0)