Commit 793986a
committed
fix: use incremental hashing in Preset.get_hash() to avoid loading entire file into memory
Preset.get_hash() called f.read() which loads the entire file into
memory before hashing. Use incremental hashlib.sha256().update()
with 64 KiB chunks to prevent unbounded memory allocation on large
or maliciously sized preset files.1 parent 5e2f9bc commit 793986a
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
| 455 | + | |
455 | 456 | | |
456 | | - | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
457 | 460 | | |
458 | 461 | | |
459 | 462 | | |
| |||
0 commit comments