Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASSERT(size==0) FAILED AT src/jsvar.c:326 ASSERT(ref <= jsVarsSize) FAILED AT src/jsvar.c:223 #2366

Closed
Limesss opened this issue May 10, 2023 · 4 comments

Comments

@Limesss
Copy link

Limesss commented May 10, 2023

Reproduce:
make Debug=1

POC:

load("./standalone-pre.js", "caller relative");

"use strict";

var typedArrays = ["Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "Float32Array", "Float64Array"];

function forEachTypedArray(constructors, testFunction, name, args) {
    for (let i = 0; i < constructors.length; ++i) {
        let typedArray = constructors[i];

        let result;
        if (name !== "")
            result = eval(typedArray + "." + name + args)
        else
            result = eval("new " + typedArray + args)

        let testResult = testFunction(result, typedArray)
        if (testResult !== true)
            return testResult;
    }

    return true;
}

function hasSameValues(msg, array1, array2) {
    if (array1.length !== array2.length) {
        debug(msg +  "The arrays had differing lengths, first array: " + array1 + " length: " + array1.length + " second array: " + array2 + " length" + array2.length);
        return false;
    }

    let allSame = true;
    for (let i = 0; i < array1.length; ++i) {
        allSame = allSame && Object.is(array1[i], array2[i]);
    }

    if (!allSame)
        debug(msg +  "The array did not have all the expected elements, first array: " + array1 + " second array: " + array2);
    return allSame;

}

function testConstructorFunction(name, args, expected) {
    function foo(array, constructor) {
        if (!hasSameValues(constructor + "." + name + " did not produce the correct result on " + name + args, array, expected))
            return false
        return true;
    }

    return forEachTypedArray(typedArrays, foo, name, args);
}

function testConstructor(args, expected) {
    function foo(array, constructor) {
        if (!hasSameValues(constructor + args + " did not produce the correct result", array, expected))
            return false
        return true;
    }

    return forEachTypedArray(typedArrays, foo, "", args);
}

details:
ASSERT(size==0) FAILED AT src/jsvar.c:326
ASSERT(ref <= jsVarsSize) FAILED AT src/jsvar.c:223

@gfwilliams
Copy link
Member

Thanks for these reports, however given the volume of different reports you've submitted in just a few minutes: #2360 #2361 #2362 #2363 #2364 #2365 #2366 you've submitted, it'd be great if you could also help to contribute fixes

Could you provide any information about how you came across these issues?

@Limesss
Copy link
Author

Limesss commented May 10, 2023

Thanks for these reports, however given the volume of different reports you've submitted in just a few minutes: #2360 #2361 #2362 #2363 #2364 #2365 #2366 you've submitted, it'd be great if you could also help to contribute fixes

Could you provide any information about how you came across these issues?

Hi ,gfwilliams,i just run the testcase from others javascript engine . and i will try my best to help

@Limesss
Copy link
Author

Limesss commented May 10, 2023 via email

@gfwilliams
Copy link
Member

Answered when you posted the same question in #2360 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants