pjfanning commented on code in PR #1071:
URL: https://github.com/apache/poi/pull/1071#discussion_r3250388914
##########
poi-scratchpad/src/main/java/org/apache/poi/hmef/CompressedRTF.java:
##########
@@ -79,19 +105,28 @@ public void decompress(InputStream src, OutputStream res)
throws IOException {
/* int dataCRC = */ LittleEndian.readInt(src);
// TODO - Handle CRC checking on the output side
+ IOUtils.safelyAllocateCheck(decompressedSize, MAX_RECORD_LENGTH);
+ LimitedOutputStream limited = new LimitedOutputStream(res,
decompressedSize + MAX_PADDING_LENGTH);
// Do we need to do anything?
if(compressionType == UNCOMPRESSED_SIGNATURE_INT) {
// Nope, nothing fancy to do
- IOUtils.copy(src, res);
+ copyCompressedPayload(src, limited);
+ return;
Review Comment:
don't use return like this - also copyCompressedPayload has its own limit
checks, quite untidy to do this
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]