Commit 1232fca
Varun Deep Saini
MDEV-35548: Fix out-of-bounds array access in json_get_path_start
json_get_path_start() set p->last_step to p->steps - 1, creating a
pointer before the beginning of the steps[] array. This is undefined
behavior flagged by UBSAN as "index -1 out of bounds for type
json_path_step_t[32]".
Use NULL as the sentinel value instead, and check for NULL in
json_get_path_next() rather than comparing against p->steps.
Signed-off-by: Varun Deep Saini <varun.23bcs10048@ms.sst.scaler.com>1 parent e520abd commit 1232fca
3 files changed
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1773 | 1773 | | |
1774 | 1774 | | |
1775 | 1775 | | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
1776 | 1784 | | |
1777 | 1785 | | |
1778 | 1786 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1239 | 1239 | | |
1240 | 1240 | | |
1241 | 1241 | | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
1242 | 1246 | | |
1243 | 1247 | | |
1244 | 1248 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1701 | 1701 | | |
1702 | 1702 | | |
1703 | 1703 | | |
1704 | | - | |
| 1704 | + | |
1705 | 1705 | | |
1706 | 1706 | | |
1707 | 1707 | | |
1708 | 1708 | | |
1709 | 1709 | | |
1710 | 1710 | | |
1711 | | - | |
| 1711 | + | |
1712 | 1712 | | |
1713 | 1713 | | |
1714 | 1714 | | |
| |||
0 commit comments