avro
avro copied to clipboard
AVRO-3221: Verify NUL termination on set_string_len and make buffer more compact
Previously all size
bytes were copied from the given string,
including the required NUL terminator, and then another NUL terminator
was appended in avro_raw_string_set_length.
Now the existence of the NUL terminator is verified, allowing to
catch programmer mistakes and then only size
- 1 bytes are copied
before appending the NUL terminator.
Make sure you have checked all steps below.
Jira
- [x] My PR addresses the following Avro Jira issues and references them in the PR title. For example, "AVRO-1234: My Avro PR"
- https://issues.apache.org/jira/browse/AVRO-3221
- In case you are adding a dependency, check if the license complies with the ASF 3rd Party License Policy.
Tests
- [x] My PR adds the following unit tests OR does not need testing for this extremely good reason:
Test that setting a non-null terminated string fails.
Commits
- [x] My commits all reference Jira issues in their subject lines. In addition, my commits follow the guidelines from "How to write a good git commit message":
- Subject is separated from body by a blank line
- Subject is limited to 50 characters (not including Jira issue reference)
- Subject does not end with a period
- Subject uses the imperative mood ("add", not "adding")
- Body wraps at 72 characters
- Body explains "what" and "why", not "how"