Re: [PR] HemfPlusPath: validate PointCount before array al location [poi]

pjfanning (via GitHub) <[email protected]>
Newsgroups gmane.comp.jakarta.poi.devel
Message-ID <PR_kwDOAAMmIM7h3jEp-2cf55200-63ab-4948-9232-fa612645eaa1@gitbox.apache.org>
pjfanning commented on code in PR #1103:
URL: https://github.com/apache/poi/pull/1103#discussion_r3343565541


##########
poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusPath.java:
##########
@@ -60,6 +61,21 @@ public enum EmfPlusPathPointType {
 
     @SuppressWarnings("unused")
     public static class EmfPlusPath implements EmfPlusObjectData, EmfPlusCompressed, EmfPlusRelativePosition {
+        /**
+         * The maximum number of points (and associated point types) we allocate for a single path.
+         * PointCount is an untrusted 32-bit field, so cap it before it is used as an array length -
+         * consistent with e.g. {@code HemfPlusDraw.MAX_OBJECT_SIZE} and {@code HemfDraw.MAX_NUMBER_OF_POLYGONS}.
+         */
+        private static final int DEFAULT_MAX_POINTS = 1_000_000;
+        private static int MAX_POINTS = DEFAULT_MAX_POINTS;
+
+        /**
+         * @param maxPoints the maximum number of points allowed for a single path
+         */

Review Comment:
   add a getter as that is more normal in Java and we tend to have getters to match the setters



-- 
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]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.