Validate complete import depth numbers

This commit is contained in:
2026-10-20 00:27:55 +00:00
parent 7f8ad81065
commit d3a714a1cb
3 changed files with 40 additions and 3 deletions

View File

@@ -427,7 +427,8 @@ func parseImportDepth(node *document.Node) (int, bool) {
}
digit := uint64(character - '0')
if value > (maxInt-digit)/10 {
return int(maxInt), true
value = maxInt
continue // Saturate the bound, but validate every remaining character.
}
value = value*10 + digit
}