mirror of
https://github.com/xcat2/confluent.git
synced 2026-01-11 18:42:29 +00:00
Restrict maximum attribute size from formatting
If an expression causes an inordinate amount of memory to be used, then block it from continuing. For now, we consider that an expression that expands beyond 16k. I am unable to conceive of a use case where someone would want to use an expression to derive more than 16k as it stands, as we don't carry any particularly large opaque payloads right now.
This commit is contained in:
@@ -1112,7 +1112,10 @@ class _ExpressionFormat(string.Formatter):
|
||||
val = int(val)
|
||||
except Exception:
|
||||
pass
|
||||
return format(val, format_spec)
|
||||
formatted = format(val, format_spec)
|
||||
if len(formatted) > 16384:
|
||||
raise Exception('Field length exceeded during formatting')
|
||||
return formatted
|
||||
|
||||
def _handle_ast_node(self, node):
|
||||
if isinstance(node, ast.Num):
|
||||
|
||||
Reference in New Issue
Block a user