-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fix for issue 96. #100
Fix for issue 96. #100
Conversation
JUnit Test Report 46 files + 1 46 suites +1 4m 45s ⏱️ + 1m 29s Results for commit 958c8c4. ± Comparison against base commit 5ea94d1. This pull request removes 2 and adds 22 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
pbj-core/pbj-runtime/src/main/java/com/hedera/pbj/runtime/ProtoParserTools.java
Outdated
Show resolved
Hide resolved
pbj-core/pbj-runtime/src/main/java/com/hedera/pbj/runtime/ProtoParserTools.java
Show resolved
Hide resolved
pbj-integration-tests/src/test/java/com/hedera/pbj/intergration/test/Issue96Test.java
Outdated
Show resolved
Hide resolved
pbj-integration-tests/src/test/java/com/hedera/pbj/intergration/test/Issue96Test.java
Outdated
Show resolved
Hide resolved
pbj-integration-tests/src/test/java/com/hedera/pbj/intergration/test/Issue96Test.java
Outdated
Show resolved
Hide resolved
pbj-integration-tests/src/test/java/com/hedera/pbj/intergration/test/Issue96Test.java
Outdated
Show resolved
Hide resolved
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.
Think we still need to check at the end of parsing a sub-object that all the expected bytes were read. Anywhere there is length encoded data with a length, we should enforce we never read more or less bytes than specified in length.
@jasperpotts I aded the extra check. I added the check to make sure we have enough limit (which is a fast fail - without having the actual read). It does make sense to do the check after the read as well, so added code there as well. Thanks! |
pbj-integration-tests/src/test/java/com/hedera/pbj/intergration/test/TruncatedDataTests.java
Show resolved
Hide resolved
pbj-integration-tests/src/test/java/com/hedera/pbj/intergration/test/TruncatedDataTests.java
Show resolved
Hide resolved
pbj-integration-tests/src/test/java/com/hedera/pbj/intergration/test/TruncatedDataTests.java
Show resolved
Hide resolved
pbj-core/pbj-runtime/src/main/java/com/hedera/pbj/runtime/ProtoParserTools.java
Outdated
Show resolved
Hide resolved
We also need to check that all cases are covered. In protobuf there are a few core data types, fixed length, variant and length encoded. All length encoded data we need to make sure all of the specified length bytes are read or throw exception. Otherwise we can start processing the remaining data as a different field and get corrupt data. Length encoded includes, strings, bytes and sub-messages as maybe others. |
We should also check anywhere we do a bulk read of bytes with |
Added tests for all the types. Signed-off-by: Lubomir Litchev <[email protected]>
Signed-off-by: Lubomir Litchev <[email protected]>
Signed-off-by: Lubomir Litchev <[email protected]>
If the buffer is truncated on the boundary of the subObject, we still need to throw an exception. Signed-off-by: Lubomir Litchev <[email protected]>
While strictParsing, we should make sure the buffer is not empty when parsing strictly a type from buffer. This can happen if the buffer is truncated to an empty one. Signed-off-by: Lubomir Litchev <[email protected]>
Signed-off-by: Lubomir Litchev <[email protected]>
Signed-off-by: Lubomir Litchev <[email protected]>
Signed-off-by: Lubomir Litchev <[email protected]>
5f7a65a
to
522e667
Compare
Signed-off-by: Ivan Malygin <[email protected]>
522e667
to
983a4a4
Compare
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
Signed-off-by: Ivan Malygin <[email protected]>
Signed-off-by: Ivan Malygin <[email protected]>
3db7895
to
e6ca170
Compare
pbj-core/pbj-runtime/src/main/java/com/hedera/pbj/runtime/ProtoParserTools.java
Outdated
Show resolved
Hide resolved
… Cleaned up redundand `throw IOException` Signed-off-by: Ivan Malygin <[email protected]>
c48f1b0
to
958c8c4
Compare
Added tests for all the types.
Related issue(s):
Fixes #96
Fixes #73