@@ -1021,6 +1021,11 @@ class FormatLiteral extends Literal {
10211021 */
10221022 int getMaxConvertedLength ( int n ) { result = max ( int l | l = getMaxConvertedLength ( n , _) | l ) }
10231023
1024+ /**
1025+ * Gets the maximum length of the string that can be produced by the nth
1026+ * conversion specifier of this format string, specifying the estimation reason;
1027+ * has no result if this cannot be determined.
1028+ */
10241029 int getMaxConvertedLength ( int n , BufferWriteEstimationReason reason ) {
10251030 exists ( int len |
10261031 (
@@ -1238,6 +1243,13 @@ class FormatLiteral extends Literal {
12381243 result = max ( int l | l = getMaxConvertedLengthLimited ( n , _) | l )
12391244 }
12401245
1246+ /**
1247+ * Gets the maximum length of the string that can be produced by the nth
1248+ * conversion specifier of this format string, specifying the reason for the
1249+ * estimation, except that float to string conversions are assumed to be 8
1250+ * characters. This is helpful for determining whether a buffer overflow is
1251+ * caused by long float to string conversions.
1252+ */
12411253 int getMaxConvertedLengthLimited ( int n , BufferWriteEstimationReason reason ) {
12421254 if this .getConversionChar ( n ) .toLowerCase ( ) = "f"
12431255 then result = this .getMaxConvertedLength ( n , reason ) .minimum ( 8 )
@@ -1319,10 +1331,21 @@ class FormatLiteral extends Literal {
13191331 */
13201332 int getMaxConvertedLengthLimited ( ) { result = this .getMaxConvertedLengthAfterLimited ( 0 , _) }
13211333
1334+ /**
1335+ * Gets the maximum length of the string that can be produced by this format
1336+ * string, specifying the reason for the estimate. Has no result if no estimate
1337+ * can be found.
1338+ */
13221339 int getMaxConvertedLengthWithReason ( BufferWriteEstimationReason reason ) {
13231340 result = this .getMaxConvertedLengthAfter ( 0 , reason )
13241341 }
13251342
1343+ /**
1344+ * Gets the maximum length of the string that can be produced by this format
1345+ * string, specifying the reason for the estimate, except that float to string
1346+ * conversions are assumed to be 8 characters. This is helpful for determining
1347+ * whether a buffer overflow is caused by long float to string conversions.
1348+ */
13261349 int getMaxConvertedLengthLimitedWithReason ( BufferWriteEstimationReason reason ) {
13271350 result = this .getMaxConvertedLengthAfterLimited ( 0 , reason )
13281351 }
0 commit comments