| # Tensorizer Huge Header Allocation DoS |
|
|
| This repository contains a small Tensorizer `.tensors` proof of concept. |
|
|
| The PoC file declares a very large per-tensor header length while only containing |
| the first eight bytes of that header. `TensorDeserializer.read_numpy_arrays()` |
| allocates `bytearray(header_len)` before checking that the declared header bytes |
| exist in the file. |
|
|
| Run: |
|
|
| ```bash |
| python build_and_verify.py |
| ``` |
|
|
| Expected result: |
|
|
| - `control_small_header.tensors` returns quickly. |
| - `tensorizer_huge_header_allocation_dos.tensors` is only 122 bytes but declares |
| an 8 GiB tensor header and causes a large allocation / long delay before |
| raising a parser error. |
| - ModelScan reports no issues for the PoC file. |
|
|