diff options
author | Kevin Backhouse <kevinbackhouse@github.com> | 2022-07-12 19:48:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-12 11:48:10 -0700 |
commit | 8c1808151f4c1b44e8b0fe935c571f05b2641b8b (patch) | |
tree | ed7dc9e5aac6945cae8df53e3f3ec1df6e120319 /parse.y | |
parent | 8309b1366c3307ab8d9cda5b61b91540cf6cc8aa (diff) |
Fix some UBSAN false positives (#6115)
* Fix some UBSAN false positives.
* ruby tool/update-deps --fix
Notes
Notes:
Merged-By: jhawthorn <john@hawthorn.email>
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -232,12 +232,12 @@ enum { }; #define NUMPARAM_ID_P(id) numparam_id_p(id) -#define NUMPARAM_ID_TO_IDX(id) (unsigned int)(((id) >> ID_SCOPE_SHIFT) - tNUMPARAM_1 + 1) -#define NUMPARAM_IDX_TO_ID(idx) TOKEN2LOCALID((tNUMPARAM_1 + (idx) - 1)) +#define NUMPARAM_ID_TO_IDX(id) (unsigned int)(((id) >> ID_SCOPE_SHIFT) - (tNUMPARAM_1 - 1)) +#define NUMPARAM_IDX_TO_ID(idx) TOKEN2LOCALID((tNUMPARAM_1 - 1 + (idx))) static int numparam_id_p(ID id) { - if (!is_local_id(id)) return 0; + if (!is_local_id(id) || id < (tNUMPARAM_1 << ID_SCOPE_SHIFT)) return 0; unsigned int idx = NUMPARAM_ID_TO_IDX(id); return idx > 0 && idx <= NUMPARAM_MAX; } |