Skip to content

Commit 6b35eb9

Browse files
Add seperate err msg for Unpack issue
Signed-off-by: Athish Pranav D <[email protected]>
1 parent 0e98334 commit 6b35eb9

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

include/fluent-bit/flb_msgpack_append_message.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#define FLB_MAP_NOT_MODIFIED -1
2626
#define FLB_MAP_EXPANSION_ERROR -2
2727
#define FLB_MAP_EXPANSION_INVALID_VALUE_TYPE -3
28+
#define FLB_MSGPACK_UNPACK_ERROR -4
2829

2930
#include <fluent-bit/flb_pack.h>
3031
#include <msgpack/unpack.h>

plugins/filter_parser/filter_parser.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ static int configure(struct filter_parser_ctx *ctx,
101101
int ret;
102102
struct mk_list *head;
103103
struct flb_kv *kv;
104-
ctx->hash_value_field = NULL;
105104

106105
ctx->key_name = NULL;
107106
ctx->reserve_data = FLB_FALSE;
108107
ctx->preserve_key = FLB_FALSE;
108+
ctx->hash_value_field = NULL;
109109
mk_list_init(&ctx->parsers);
110110

111111
if (flb_filter_config_map_set(f_ins, ctx) < 0) {
@@ -353,7 +353,7 @@ static int cb_parser_filter(const void *data, size_t bytes,
353353
out_buf = strdup(parsed_buf);
354354
out_size = parsed_size;
355355
}
356-
if (ctx->hash_value_field!=NULL) {
356+
if (ctx->hash_value_field != NULL) {
357357
char *new_buf = NULL;
358358
size_t new_size;
359359
int ret;

src/flb_msgpack_append_message.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,15 @@ int flb_msgpack_append_map_to_record(char **result_buffer,
111111
message_entry.key.via.str.ptr = message_key_name;
112112

113113
msgpack_unpacked_init(&unpacker);
114-
if ((i=msgpack_unpack_next(&unpacker, map_data, map_size, &off)) !=
115-
MSGPACK_UNPACK_SUCCESS ) {
114+
if ((i = msgpack_unpack_next(&unpacker,
115+
map_data,
116+
map_size, &off)) != MSGPACK_UNPACK_SUCCESS) {
116117
msgpack_unpacked_destroy(&unpacker);
117-
return FLB_MAP_EXPANSION_ERROR;
118+
return FLB_MSGPACK_UNPACK_ERROR;
118119
}
119120
if (unpacker.data.type != MSGPACK_OBJECT_MAP) {
120121
msgpack_unpacked_destroy(&unpacker);
121-
return FLB_MAP_EXPANSION_ERROR;
122+
return FLB_MSGPACK_UNPACK_ERROR;
122123
}
123124

124125
message_entry.val = unpacker.data;

0 commit comments

Comments
 (0)