You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/usr/bin/python3
import yaml
import sys
with open(sys.argv[1], 'r', encoding="utf-8",errors='ignore') as inp_file:
test_string = inp_file.read()
yaml.safe_load(test_string)
Error message:
$ python3 test.py ./crash-test.txt
Traceback (most recent call last):
File "/root/test.py", line 8, in
yaml.safe_load(test_string)
File "/root/ttt/lib/python3.11/site-packages/PyYAML-7.0.0.dev0-py3.11-linux-x86_64.egg/yaml/init.py", line 125, in safe_load
return load(stream, SafeLoader)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/ttt/lib/python3.11/site-packages/PyYAML-7.0.0.dev0-py3.11-linux-x86_64.egg/yaml/init.py", line 81, in load
return loader.get_single_data()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/ttt/lib/python3.11/site-packages/PyYAML-7.0.0.dev0-py3.11-linux-x86_64.egg/yaml/constructor.py", line 49, in get_single_data
node = self.get_single_node()
^^^^^^^^^^^^^^^^^^^^^^
File "/root/ttt/lib/python3.11/site-packages/PyYAML-7.0.0.dev0-py3.11-linux-x86_64.egg/yaml/composer.py", line 35, in get_single_node
if not self.check_event(StreamEndEvent):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/ttt/lib/python3.11/site-packages/PyYAML-7.0.0.dev0-py3.11-linux-x86_64.egg/yaml/parser.py", line 98, in check_event
self.current_event = self.state()
^^^^^^^^^^^^
File "/root/ttt/lib/python3.11/site-packages/PyYAML-7.0.0.dev0-py3.11-linux-x86_64.egg/yaml/parser.py", line 142, in parse_implicit_document_start
if not self.check_token(DirectiveToken, DocumentStartToken,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/ttt/lib/python3.11/site-packages/PyYAML-7.0.0.dev0-py3.11-linux-x86_64.egg/yaml/scanner.py", line 116, in check_token
self.fetch_more_tokens()
File "/root/ttt/lib/python3.11/site-packages/PyYAML-7.0.0.dev0-py3.11-linux-x86_64.egg/yaml/scanner.py", line 251, in fetch_more_tokens
return self.fetch_double()
^^^^^^^^^^^^^^^^^^^
File "/root/ttt/lib/python3.11/site-packages/PyYAML-7.0.0.dev0-py3.11-linux-x86_64.egg/yaml/scanner.py", line 655, in fetch_double
self.fetch_flow_scalar(style='"')
File "/root/ttt/lib/python3.11/site-packages/PyYAML-7.0.0.dev0-py3.11-linux-x86_64.egg/yaml/scanner.py", line 666, in fetch_flow_scalar
self.tokens.append(self.scan_flow_scalar(style))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/ttt/lib/python3.11/site-packages/PyYAML-7.0.0.dev0-py3.11-linux-x86_64.egg/yaml/scanner.py", line 1149, in scan_flow_scalar
chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/ttt/lib/python3.11/site-packages/PyYAML-7.0.0.dev0-py3.11-linux-x86_64.egg/yaml/scanner.py", line 1217, in scan_flow_scalar_non_spaces
chunks.append(chr(code))
^^^^^^^^^
OverflowError: Python int too large to convert to C int
On some configs error "OverflowError: signed integer is greater than maximum"
Crash present at least from v6.0, appears with and without libyaml.
Hi! I'v found crash with OverflowError.
Way to reproduce
Error message:
On some configs error "OverflowError: signed integer is greater than maximum"
Crash present at least from v6.0, appears with and without libyaml.
There is a patch in cpython fixing OverflowError to ValueError.
python/cpython@e2c4038
crash-test.txt
The text was updated successfully, but these errors were encountered: