diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-06-12 01:16:36 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-06-12 01:16:36 +0200 |
commit | f7c81dc4ac2ca6e3aed325945927cfe3417f6b9a (patch) | |
tree | 7b594357dd2dc4417cd34d74b1f7cc6ec1ed82f0 /vendor/gmp-6.3.0/mpn/x86/skylake | |
parent | faf04402985b1a964298a51985d91ae348015230 (diff) |
Fix alignof() usage and a very sneaky bug
It might seem innocuous, but the following expression is actually quite
prone to breakage:
ast->kids[i].lhs = parseexpr(ast, toks);
The reason is that parseexpr() and the other parsing functions return
indicies into the AST, however in doing so they may find that the AST
needs to grow and call astresz(). Should astresz() be called there is a
chance that we will realloc() a new buffer somewhere else in memory,
causing the left-hand side of the above expression to now be pointing to
an invalid location in memory. To combat this we’re forced to break it
up into two statements:
idx_t_ lhs = parseexpr(ast, toks);
ast->kids[i].lhs = lhs;
Diffstat (limited to 'vendor/gmp-6.3.0/mpn/x86/skylake')
0 files changed, 0 insertions, 0 deletions