Open Bug 2089962 Opened 14 days ago Updated 9 days ago

Remove the dead memory null check in wasm Instance::init

Categories

(Core :: JavaScript: WebAssembly, task, P3)

task

Tracking

()

People

(Reporter: Sylvestre, Unassigned, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [lang=c++])

Filing as a good first bug to learn workflows.

In Instance::init, every memories[i] is a real WasmMemoryObject that is already dereferenced earlier (memory->buffer()), so memory && below is dead. Drop it.

Current code:

    // Add observer if our memory base may grow
    if (memory && memory->movingGrowable() &&
        !memory->addMovingGrowObserver(cx, object_)) {

Link to the code:
https://searchfox.org/firefox-main/source/js/src/wasm/WasmInstance.cpp

To verify the fix:

./mach build
./mach jit-test wasm

This was reported by Coverity Scan (CID 1537978). The analyzer will stop reporting it once the change lands.

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

Severity: -- → N/A
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.