mirror of https://github.com/google/oss-fuzz.git
Limit the input size of pygments fuzzers (#10013)
This commit is contained in:
parent
00ac1ba576
commit
3264034794
|
@ -22,6 +22,9 @@ import pygments.lexers
|
|||
import pygments.util
|
||||
|
||||
def TestOneInput(data: bytes) -> int:
|
||||
if len(data) > (2 << 18):
|
||||
return
|
||||
|
||||
try:
|
||||
lexer = pygments.lexers.guess_lexer(str(data))
|
||||
except pygments.util.ClassNotFound:
|
||||
|
|
|
@ -32,6 +32,8 @@ FORMATTERS = [BBCodeFormatter(), GroffFormatter(), HtmlFormatter(),
|
|||
|
||||
|
||||
def TestOneInput(data: bytes) -> int:
|
||||
if len(data) > (2 << 18):
|
||||
return
|
||||
fdp = atheris.FuzzedDataProvider(data)
|
||||
random_lexer = pygments.lexers.get_lexer_by_name(fdp.PickValueInList(LEXERS))
|
||||
formatter = fdp.PickValueInList(FORMATTERS)
|
||||
|
|
Loading…
Reference in New Issue