ppkarwasz commented on code in PR #722:
URL: https://github.com/apache/commons-compress/pull/722#discussion_r2502840689
##########
src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java:
##########
@@ -760,23 +707,26 @@ protected static Map<String, String>
parsePaxHeaders(final InputStream inputStre
while ((ch = inputStream.read()) != -1) {
read++;
totalRead++;
- if (totalRead < 0 || headerSize >= 0 && totalRead >=
headerSize) {
+ if (totalRead < 0 || totalRead >= headerSize) {
Review Comment:
`totalRead` is an `int`, so it can become negative if an integer overflow
occurs.
However, this comment reminds me that `headerSize` in `readPaxHeaders` is
**not** necessary: the `inputStream.read()` will return `-1`, after
`headerSize` bytes have been consumed. I have an old local branches that
simplifies this code. I will submit it **after** this PR is merged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]