_sre.template
crashes in case of negative or non-integer group index
#106524
Labels
_sre.template
crashes in case of negative or non-integer group index
#106524
_sre.template
crashes iftemplate
argument contains group index that is negative or not anint
instance.Examples:
In
_sre_template_impl
part ofself->items
remains uninitialized if call toPyLong_AsSsize_t
returns negative value or fails with exception. Then attempt to clearself->items[i].literal
intemplate_clear
leads to dereferencing of uninitialized pointer.Not sure if this worth fixing, since
_sre.template
is an internal implementation detail that is used only in_compile_template
function, where it accepts only (I guess) correct templates created in_parser.parse_template
function, and additional checks/initialization can affect its performance. But I'll submit a PR anyway.Linked PRs
_sre.template
#106525The text was updated successfully, but these errors were encountered: