-
Notifications
You must be signed in to change notification settings - Fork 1.8k
utils: plugins: Provide a choice for encoding raw UTF-8 strings #10665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
701ebf8
81e1ddf
89c8751
acb0bb9
4a2c644
aecd6dc
e18405f
0529b3b
2d6fb64
54ffb04
0904ab5
a01f35b
98c3030
70e25f8
8187dd6
37b0292
4cf8872
62e042e
79d0ce1
1c0e411
f264680
5b617c6
0b74022
94825c5
3d1029d
4934537
0e11002
224e344
1c5cb40
570d3c5
53a75b1
5e9c7f6
b2e8c67
75789d0
d5b49fb
38c39fc
b5a69f1
b452691
147c7a2
91ba6e1
ea459c8
44a0d29
d8bc307
f335009
5bd0af2
cd402ee
246945a
f2beec0
ed29fdb
d700219
46c7207
35eba05
e362186
fc3b9c9
8e59ec7
10308d2
171f174
594cf85
2747779
2d490b9
abf6cb3
3420877
c1dfe9a
4510a2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -847,7 +847,8 @@ static int cb_bigquery_init(struct flb_output_instance *ins, | |
| static int bigquery_format(const void *data, size_t bytes, | ||
| const char *tag, size_t tag_len, | ||
| char **out_data, size_t *out_size, | ||
| struct flb_bigquery *ctx) | ||
| struct flb_bigquery *ctx, | ||
| struct flb_config *config) | ||
| { | ||
| int array_size = 0; | ||
| flb_sds_t out_buf; | ||
|
|
@@ -937,7 +938,8 @@ static int bigquery_format(const void *data, size_t bytes, | |
| } | ||
|
|
||
| /* Convert from msgpack to JSON */ | ||
| out_buf = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size); | ||
| out_buf = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size, | ||
| config->json_escape_unicode); | ||
|
|
||
|
Comment on lines
+941
to
943
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing NULL-check before dereferencing
- out_buf = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size,
- config->json_escape_unicode);
+ if (!config) {
+ flb_plg_error(ctx->ins, "NULL config passed to bigquery_format()");
+ return -1;
+ }
+ out_buf = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size,
+ config->json_escape_unicode);
🤖 Prompt for AI Agents |
||
| flb_log_event_decoder_destroy(&log_decoder); | ||
| msgpack_sbuffer_destroy(&mp_sbuf); | ||
|
|
@@ -996,7 +998,7 @@ static void cb_bigquery_flush(struct flb_event_chunk *event_chunk, | |
| /* Reformat msgpack to bigquery JSON payload */ | ||
| ret = bigquery_format(event_chunk->data, event_chunk->size, | ||
| event_chunk->tag, flb_sds_len(event_chunk->tag), | ||
| &payload_buf, &payload_size, ctx); | ||
| &payload_buf, &payload_size, ctx, config); | ||
| if (ret != 0) { | ||
| flb_upstream_conn_release(u_conn); | ||
| flb_sds_destroy(token); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -311,7 +311,7 @@ static flb_sds_t get_agent_metadata(struct flb_calyptia *ctx) | |
| flb_mp_map_header_end(&mh); | ||
|
|
||
| /* convert to json */ | ||
| meta = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size); | ||
| meta = flb_msgpack_raw_to_json_sds(mp_sbuf.data, mp_sbuf.size, FLB_TRUE); /* could be ASCII */ | ||
| msgpack_sbuffer_destroy(&mp_sbuf); | ||
|
|
||
| return meta; | ||
|
|
@@ -532,7 +532,7 @@ static int store_session_get(struct flb_calyptia *ctx, | |
| } | ||
|
|
||
| /* decode */ | ||
| json = flb_msgpack_raw_to_json_sds(buf, size); | ||
| json = flb_msgpack_raw_to_json_sds(buf, size, FLB_TRUE); /* TODO: could be ASCII? */ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we resolve this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure but the current pattern of usages do not have multibytes between the dedicated service and this plugin. |
||
| flb_free(buf); | ||
| if (!json) { | ||
| return -1; | ||
|
|
@@ -1029,7 +1029,8 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk, | |
| event_chunk->size, | ||
| FLB_PACK_JSON_FORMAT_STREAM, | ||
| FLB_PACK_JSON_DATE_DOUBLE, | ||
| NULL); | ||
| NULL, | ||
| FLB_TRUE); /* Trace is ASCII */ | ||
| if (json == NULL) { | ||
| flb_upstream_conn_release(u_conn); | ||
| FLB_OUTPUT_RETURN(FLB_RETRY); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.