Fixes a memory leak issue in the Avro C library under abnormal data scenarios.#3635
Fixes a memory leak issue in the Avro C library under abnormal data scenarios.#3635kwenzh wants to merge 5 commits into
Conversation
| return mem_reader->len - mem_reader->read; | ||
| } else if (is_file_io(reader)) { | ||
| struct _avro_reader_file_t *file_reader = avro_reader_to_file(reader); | ||
| return bytes_available(file_reader); |
There was a problem hiding this comment.
This returns only the buffered bytes, not all remaining bytes as the memory io branch above
There was a problem hiding this comment.
sorry, I haven't found a way to get the remaining buffer length for file I/O. My goal is to check the maximum readable length before malloc to avoid memory leaks caused by the length exceeding the limit during avro_read_memory checks. Are there any other good solutions?
There was a problem hiding this comment.
This returns only the buffered bytes, not all remaining bytes as the memory io branch above
maybe use (int64_t) sizeof(reader->buffer) , Am I understanding this correctly?
There was a problem hiding this comment.
This returns only the buffered bytes, not all remaining bytes as the memory io branch above
I re-optimized the function logic.
|
Is anything preventing this particular request to be merged? |
|
Why can't the fix simply include the addition of the |
There are no active maintainers of the C SDK... We will need to the community to review and approve the changes before merging it. |
|
Is this issue confirmed? Are there any other questions regarding the code modification logic? |
How can one become such a maintainer? Also, what does it mean the community needs to review? |
Is there a reasons why the modifications can't simply revolve around replacing |
https://community.apache.org/contributors/becomingacommitter.html
It means that the users of the C SDK are encouraged to review the PR(s) and comment on them - what is good and bad. Once a PR is approved by a few users we (the maintainers of the other SDKs) can merge it and make it part of the next release. |
The current modification is as follows, isn't ? |
What is the purpose of the |
safe code to preventtoo big mem allocate |
What is the purpose of the change
AVRO_SAFE_READto release memory upon exception return.Verifying this change
read_stringfunction to read them.Alternatively, you can use
valgrindto check for memory leaks.Documentation