Commit 2d32ccf
committed
FIX: reject out-of-range charmap index in FT2Font.set_charmap
FT2Font.set_charmap(i) only checked the upper bound (i >= num_charmaps).
A negative i passed the check and was used to index face->charmaps[i],
an out-of-bounds read whose result was then dereferenced by
FT_Set_Charmap, crashing the interpreter (e.g. set_charmap(-1)).
Reject negative indices as well, raising the same RuntimeError already
used for too-large indices. Valid indices in [0, num_charmaps) are
unaffected.1 parent 1e6bcaf commit 2d32ccf
2 files changed
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
349 | 357 | | |
350 | 358 | | |
351 | 359 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
272 | | - | |
| 272 | + | |
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
| |||
0 commit comments