Menu

Issues with vsscanf

snarfle
2016-06-29
2016-08-06
  • snarfle

    snarfle - 2016-06-29

    I was looking at the inline asm for ms_vsscanf. I noticed a few issues with it.

    But more importantly, the code is fundamentally flawed (as described on that same link). It only works for up to ~15 tokens (depending on compile options) before you get stack corruption.

    If this is going to use a fixed size buffer (which is sort of what this code is doing now), there are easier ways to do it. It might also make sense to pick a better size.

    Unless someone can think of a way to determine the size of the va_list?

     
    • snarfle

      snarfle - 2016-07-10

      ktietz, I have created a patch that fixes the issues I have described. Since thunderbird won't let me send it to the list, I'll attach it here.

       
      • snarfle

        snarfle - 2016-07-11

        And as part of my ongoing campaign to rid the world of inline assembly, I have replaced more of it with builtins (attached).

         
        • snarfle

          snarfle - 2016-07-12

          Updated patch for the sscanf stuff.

           
          • snarfle

            snarfle - 2016-07-14

            Well, I'm running out of things to fiddle with. But I did find one more: Use .L for the internal label names. Saves 18 bytes off the size of the object file (and probably 0 on the executable).

            Note that while I don't speak ARM, I think there are some problems with the ms_vswscanf_internal and related routines (like writing to the stack before adjusting the stack pointer). And having 1 asm routine for all 4 functions (like I'm doing for x86) would sure clean up the code. When it comes to inline asm: Less is better.

             
            • snarfle

              snarfle - 2016-08-06

              After much effort I was able to get mingw-w64 to build for ARM. It turns out there was a bit of a glitch with this patch under those circumstances. See new patch (attached).

               
  • Kai Tietz

    Kai Tietz - 2016-07-12

    Hi,

    thanks for working on this. I don't want to loose here the implementations we have. it might be necessary for different environments to resurrect them ...
    So I would suggest to check for existance of those builtin functions, and then - just if they exist - to superset the current implementation.

    Regards,
    Kai

     

Log in to post a comment.