-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
pack: do not multiply out_size by realloc_size #9193
Conversation
In `flb_msgpack_raw_to_json_sds`, when the buffer is reallocated it calls `flb_sds_increase`. This increases the length by adding the `len` argument to the length and reallocating the sds object. After doing this, the `out_size` is multiplied by `realloc_size`. This does not match reality, as what happened in the reallocation was additive not multiplicative. This commit corrects the inconsistency. Signed-off-by: braydonk <[email protected]>
8556ffe
to
4975325
Compare
src/flb_pack.c
Outdated
@@ -810,7 +810,7 @@ flb_sds_t flb_msgpack_raw_to_json_sds(const void *in_buf, size_t in_size) | |||
tmp_buf = flb_sds_increase(out_buf, realloc_size); | |||
if (tmp_buf) { | |||
out_buf = tmp_buf; | |||
out_size *= realloc_size; | |||
out_size += realloc_size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch. what about to setting out_size
with flb_sds_alloc()
?
https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_sds.h#L67-L70
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 087ccda. Tested and it seems to work as expected.
Signed-off-by: braydonk <[email protected]>
087ccda
to
c937e9c
Compare
thank you |
This change picks up this chage from Fluent Bit: fluent/fluent-bit#9193
In `flb_msgpack_raw_to_json_sds`, when the buffer is reallocated it calls `flb_sds_increase`. This increases the length by adding the `len` argument to the length and reallocating the sds object. After doing this, the `out_size` is multiplied by `realloc_size`. This does not match reality, as what happened in the reallocation was additive not multiplicative. This commit corrects the inconsistency. Signed-off-by: braydonk <[email protected]>
In `flb_msgpack_raw_to_json_sds`, when the buffer is reallocated it calls `flb_sds_increase`. This increases the length by adding the `len` argument to the length and reallocating the sds object. After doing this, the `out_size` is multiplied by `realloc_size`. This does not match reality, as what happened in the reallocation was additive not multiplicative. This commit corrects the inconsistency. Signed-off-by: braydonk <[email protected]>
This change picks up this chage from Fluent Bit: fluent/fluent-bit#9193 You can check out the branch here: https://github.com/ridwanmsharif/fluent-bit/tree/ridwanmsharif/cherrypick-fluentbit-pack-bugfix
In `flb_msgpack_raw_to_json_sds`, when the buffer is reallocated it calls `flb_sds_increase`. This increases the length by adding the `len` argument to the length and reallocating the sds object. After doing this, the `out_size` is multiplied by `realloc_size`. This does not match reality, as what happened in the reallocation was additive not multiplicative. This commit corrects the inconsistency. Signed-off-by: braydonk <[email protected]>
This change picks up this chage from Fluent Bit: fluent/fluent-bit#9193 You can check out the branch here: https://github.com/ridwanmsharif/fluent-bit/tree/ridwanmsharif/cherrypick-fluentbit-pack-bugfix
This change picks up this chage from Fluent Bit: fluent/fluent-bit#9193 Related bug: b/359600424
This change picks up this chage from Fluent Bit: fluent/fluent-bit#9193 Related bug: b/359600424
In `flb_msgpack_raw_to_json_sds`, when the buffer is reallocated it calls `flb_sds_increase`. This increases the length by adding the `len` argument to the length and reallocating the sds object. After doing this, the `out_size` is multiplied by `realloc_size`. This does not match reality, as what happened in the reallocation was additive not multiplicative. This commit corrects the inconsistency. Signed-off-by: braydonk <[email protected]>
In
flb_msgpack_raw_to_json_sds
, when the buffer is reallocated it callsflb_sds_increase
. This increases the length by adding thelen
argument to the length and reallocating the sds object. After doing this, theout_size
is multiplied byrealloc_size
. This does not match reality, as what happened in the reallocation was additive not multiplicative. This commit corrects the inconsistency.Fixes #9192.
Fixes #8993.
Enter
[N/A]
in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-test
label to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.