check the buffer length read in constant meta, if it's not equal to t… #373
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was an issue with using the
LoadKnowledgeBaseFromReader
function on the*ast.KnowledgeLibrary
when passing the*tar.Reader
which had the*gzip.Reader
underlying in ther
of*tar.Reader
which should ideally not be passed because of how the*gzip.Reader
'sdecompressor
's read() method is implemented and how the library is not reading until EOF but actually reading a specific set of bytes, and for any such usecase the*gzip.Reader
is ideal, where there is a need to read a chunk of bytes and not until EOF.But this debugging(I believe) could be made faster if we had the buffer read check on
Constant Meta
'sReadMetaFrom
implementation. Basically because the decompressor had some state which had thetoRead
method which will be updated when thestep()
function which takes the pointer to thedecompressor
and changes it's state, but since it read less number of bytes than it had to. The new 8 bytes were read from different set of bytes, which would attempt to read from a different length of bytes array. Which was the issue but could have been easier to debug if there was a check in the package (according to me.).But in any case this doesn't compromise the correctness of the flow, and seems like a useful check. WDYT?