Add security guards to avoid crashes in torch::jit module#102156
Add security guards to avoid crashes in torch::jit module#102156apach301 wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/102156
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 1c51fdf: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
38988ea to
a0b553e
Compare
90ce800 to
1c51fdf
Compare
|
One of the crash is caused by integer overflow, and there is already a guard for this in ArrayRef.h, but it works wrong: Lines 191 to 210 in 1c51fdf When slice(N. M) called, it asserts that N + M <= size, where M = size - N from the caller function. So in this case assert is simplified to always true expression size <= size. |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Hi!
I've been fuzzing different pytorch modules with with sydr-fuzz, and found a multiple crashes in torch::jit::load() function.
All found errors could be reproduced with provided docker: Dockerfile.
Crash in torch/csrc/jit/unpickler.cpp:1075
crash-1f59083b8396c5b62b4705c7556e68f129e833b1.zip
Crash in torch/csrc/jit/unpickler.cpp:386
crash-2e9923de375c393e700e8c0441f0ebe8252ca364.zip
Crash in torch/csrc/jit/serialization/source_range_serialization.cpp:211
crash-5598d386057152f606bfa69d85605499e8852625.zip
Segmentation fault in /pytorch/aten/src/ATen/core/ivalue.h:526
crash-9bd059c1ae85ab9cdb41d786932214d942baa189.zip