Global variable/direct reference works, local variable doesn't - format (y_va)
#5

If I run the code I get the message the format itself crashed therefore it is unrelated to va_format

format simple crashes if the output address is out of range like
pawn Код:
NotFine(out[], size, const fmt[], va_args<>) {
    format(killer, sizeof killer, fmt, ...);

    new
        killer[128]
    ;
}
Test code
pawn Код:
main() {
    static
        addr,
        array[] = "Hello World"
    ;
    format(array, sizeof array, array);

    const
        size = sizeof array,
        byte = size * -4
    ;
    // Calculating address of tmp
    #emit lctrl 4 // stack
    #emit add.c byte
    #emit stor.pri addr

//  new tmp[sizeof array]; // works

    #emit push.c array
    #emit push.c size
    #emit push addr
    #emit push.c 12
    #emit sysreq.c format
    #emit stack 16

    new tmp[sizeof array]; // doesn't

    print(tmp);
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)