Results 1 to 10 of 22

Thread: libcod on Arch Linux

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by kung foo man View Post
    Can you try to add many normal printf's to this function in https://github.com/kungfooman/libcod...master/gsc.cpp ?


    PHP Code:
    int cdecl_injected_closer()
    {
        
    int function;
        
    int playerid
    printf by printf you will get nearer to the buggy function.
    It crashes here:
    PHP Code:
    printf("scriptengine> test b3\n");
        
        
        if (!
    stackGetParamInt(0, &function))
        {
            
    printf("scriptengine> ERROR: closer(): param \"function\"[0] has to be an integer!\n");
            return 
    0;
        }

        
    printf("scriptengine> test b4\n"); 
    It only shows 'scriptengine> test b3' and not the other 2 messages. (commenting the printf ...ERROR: closer().. out doesn't show the 'test b4' message.)
    Last edited by Mitch; 26th September 2013 at 21:09.

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    The function is in https://github.com/kungfooman/libcod...master/gsc.cpp

    PHP Code:
    // todo: check if the parameter really exists (number_of_params)
    int stackGetParamInt(int paramint *value)
    {
        
    //printf("stackGetParamInt() start...");
        
    aStackElement *scriptStack = *(aStackElement**)getStack();
        
    aStackElement *arg scriptStack param;
        if (
    arg->type != STACK_INT)
            return 
    0;
        *
    value = (int)arg->offsetData;
        
    //printf("... end\n");
        
    return 1;

    Now check in detail where it is crashing
    timescale 0.01

  3. #3
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by kung foo man View Post
    The function is in https://github.com/kungfooman/libcod...master/gsc.cpp

    PHP Code:
    // todo: check if the parameter really exists (number_of_params)
    int stackGetParamInt(int paramint *value)
    {
        
    //printf("stackGetParamInt() start...");
        
    aStackElement *scriptStack = *(aStackElement**)getStack();
        
    aStackElement *arg scriptStack param;
        if (
    arg->type != STACK_INT)
            return 
    0;
        *
    value = (int)arg->offsetData;
        
    //printf("... end\n");
        
    return 1;

    Now check in detail where it is crashing
    PHP Code:
    int stackGetParamInt(int paramint *value)
    {
        
    //printf("stackGetParamInt() start...");
        
    printf("scriptengine> test c1\n");
        
    aStackElement *scriptStack = *(aStackElement**)getStack();
        
    printf("scriptengine> test c2\n");
        
    aStackElement *arg scriptStack param;
        
    printf("scriptengine> test c3\n");
        if (
    arg->type != STACK_INT)
            return 
    0;
        
    printf("scriptengine> test c4\n");
        *
    value = (int)arg->offsetData;
        
    printf("scriptengine> test c5\n");
        
    //printf("... end\n");
        
    return 1;

    It prints c1, c2 and c3.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •