File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -510,11 +510,16 @@ void TranslateToFuzzReader::finalizeTable() {
510510 // If the offset contains a global that was imported (which is ok) but
511511 // no longer is (not ok unless GC is enabled), we may need to change
512512 // that.
513- if (!wasm.features .hasGC () &&
514- !FindAll<GlobalGet>(segment->offset ).list .empty ()) {
515- // TODO: the segments must not overlap...
516- segment->offset =
517- builder.makeConst (Literal::makeFromInt32 (0 , Type::i32 ));
513+ if (!wasm.features .hasGC ()) {
514+ for (auto * get : FindAll<GlobalGet>(segment->offset ).list ) {
515+ // N.B: We never currently encounter imported globals here, but we
516+ // do the check for robustness.
517+ if (!wasm.getGlobal (get->name )->imported ()) {
518+ // TODO: the segments must not overlap...
519+ segment->offset =
520+ builder.makeConst (Literal::makeFromInt32 (0 , Type::i32 ));
521+ }
522+ }
518523 }
519524 Address maxOffset = segment->data .size ();
520525 if (auto * offset = segment->offset ->dynCast <Const>()) {
You can’t perform that action at this time.
0 commit comments