Fuzzing: check for graphics stack overflow

Very unlikely to occur
This commit is contained in:
James R. Barlow
2016-04-18 13:08:35 -07:00
parent d0cb6c0e92
commit e926ecb8b2
+3 -3
View File
@@ -73,11 +73,9 @@ def _shorthand_from_matrix(matrix):
return tuple(map(float, (a, b, c, d, e, f)))
ContentsInfo = namedtuple('ContentsInfo', ['raster_settings', 'inline_images'])
ContentsInfo = namedtuple('ContentsInfo',
['raster_settings', 'inline_images'])
def _interpret_contents(contentstream):
operations = contentstream.operations
stack = []
@@ -89,6 +87,8 @@ def _interpret_contents(contentstream):
operands, command = op
if command == b'q':
stack.append(ctm)
if len(stack) > 32:
raise RuntimeError("PDF graphics stack overflow")
elif command == b'Q':
ctm = stack.pop()
elif command == b'cm':