Commit ad5a7b0
amalxloop
Fix bugs found in security audit: overflow, unchecked malloc, div-by-zero
- sc_gfx_resize (Bug 1): add integer overflow guard before realloc
matching the existing check in sc_gfx_init
- _sc_font_cache_glyph (Bug 2): reject glyphs wider than atlas
(gw > SC_FONT_ATLAS_W) to prevent heap buffer overflow from
memcpy past row boundary
- Vulkan backend (Bug 4): add NULL checks for all 6 unchecked
malloc/calloc calls (fmt list, swapchain arrays, phys array,
queue family props) — return VK_ERROR_OUT_OF_HOST_MEMORY or
SC_ERR_OOM on failure
- Layout SPACE_AROUND (Bug 6): add nc_in/nc > 0 guard to prevent
division by zero in both single-line and multi-line paths
- sc_font.h: document ASCII-only limitation (UTF-8 not decoded)1 parent 1369482 commit ad5a7b0
4 files changed
Lines changed: 22 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| 420 | + | |
420 | 421 | | |
421 | 422 | | |
422 | 423 | | |
| |||
454 | 455 | | |
455 | 456 | | |
456 | 457 | | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
457 | 465 | | |
458 | 466 | | |
459 | 467 | | |
| |||
731 | 739 | | |
732 | 740 | | |
733 | 741 | | |
| 742 | + | |
734 | 743 | | |
735 | 744 | | |
736 | 745 | | |
| |||
747 | 756 | | |
748 | 757 | | |
749 | 758 | | |
| 759 | + | |
750 | 760 | | |
751 | 761 | | |
752 | 762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
100 | 109 | | |
101 | 110 | | |
102 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
692 | 692 | | |
693 | 693 | | |
694 | 694 | | |
| 695 | + | |
695 | 696 | | |
696 | 697 | | |
697 | 698 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
384 | | - | |
| 384 | + | |
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
| 457 | + | |
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| |||
0 commit comments