Merge pull request #263 from tkchia/tkchia/20220801
Fix use-after-free in Modula-2 middle-end's em_m2
This commit is contained in:
commit
d728801f43
|
@ -112,10 +112,11 @@ static void chk_forw(struct def **pdf)
|
||||||
register struct def *df;
|
register struct def *df;
|
||||||
|
|
||||||
while ( (df = *pdf) ) {
|
while ( (df = *pdf) ) {
|
||||||
if (df->df_kind == D_FORWTYPE) {
|
while (df->df_kind == D_FORWTYPE) {
|
||||||
pdf = &df->df_nextinscope;
|
register struct def *df2 = df->df_nextinscope;
|
||||||
|
pdf = NULL;
|
||||||
ForceForwardTypeDef(df); /* removes df */
|
ForceForwardTypeDef(df); /* removes df */
|
||||||
continue;
|
df = df2;
|
||||||
}
|
}
|
||||||
if (df->df_kind & (D_FORWARD|D_FORWMODULE)) {
|
if (df->df_kind & (D_FORWARD|D_FORWMODULE)) {
|
||||||
/* These definitions must be found in
|
/* These definitions must be found in
|
||||||
|
@ -138,6 +139,7 @@ df->df_idf->id_text);
|
||||||
nextvisible(CurrVis);
|
nextvisible(CurrVis);
|
||||||
register struct def *df1 = lookup(df->df_idf, ls->sc_scope, 0, 0);
|
register struct def *df1 = lookup(df->df_idf, ls->sc_scope, 0, 0);
|
||||||
|
|
||||||
|
if (pdf)
|
||||||
*pdf = df->df_nextinscope;
|
*pdf = df->df_nextinscope;
|
||||||
|
|
||||||
if (! df1) {
|
if (! df1) {
|
||||||
|
|
Loading…
Reference in a new issue