Commit 68be6fe
committed
Fix GH-21738: undefined behavior in url_decode with non-ASCII bytes
The isxdigit() family requires its argument to be representable as
unsigned char (0-255) or EOF. Casting a signed char value holding a
high-bit byte (e.g. 0x80) to int produces a negative number (-128)
which triggers undefined behavior, and on some libc implementations
(e.g. NetBSD) can lead to out-of-bounds reads through the internal
character classification table.1 parent 1462499 commit 68be6fe
2 files changed
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
592 | | - | |
593 | | - | |
| 592 | + | |
| 593 | + | |
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
| |||
662 | 662 | | |
663 | 663 | | |
664 | 664 | | |
665 | | - | |
666 | | - | |
| 665 | + | |
| 666 | + | |
667 | 667 | | |
668 | 668 | | |
669 | 669 | | |
| |||
0 commit comments