eeshsaxena opened a new pull request, #13095:
URL: https://github.com/apache/gravitino/pull/13095

   ### What changes were proposed in this pull request?
   
   `JsonUtils.fromPrimitiveTypeString` recognizes parametric primitive types 
(`fixed`, `char`, `varchar`, `decimal`, `time`, `timestamp`, `timestamp_tz`) 
with unbounded `\d+` capture groups and passes the captured digits straight to 
`Integer.parseInt`. A size/precision above `Integer.MAX_VALUE` still matches 
the pattern but overflows `parseInt`, so a type string such as 
`fixed(2147483648)` raises an uncaught `NumberFormatException`.
   
   The method is designed to fall back to `Types.UnparsedType` for anything it 
does not recognize, but this overflow defeats that: the exception surfaces out 
of `TypeDeserializer` while Jackson deserializes a request (for example the 
column types of a create-table / create-view request), before request 
validation runs, so it becomes an internal error instead of the intended 
graceful handling.
   
   This wraps the parametric-parse block so an overflowing size falls through 
to `UnparsedType` like any other unrecognized type string.
   
   ### Why are the changes needed?
   
   A normal, authenticated request carrying an out-of-range parametric type 
size crashes deserialization with an uncaught `NumberFormatException` rather 
than being handled gracefully.
   
   ### Does this PR introduce any user-facing change?
   
   No. Valid type strings behave exactly as before; only an over-long numeric 
size now yields `UnparsedType` instead of throwing.
   
   ### How was this patch tested?
   
   Added `testDeserializeParametricTypeWithOverflowingSize` in `TestJsonUtils`, 
covering all seven parametric types.
   


-- 
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]

Reply via email to