rurban / safeclib

safec libc extension with all C11 Annex K functions
https://rurban.github.io/safeclib/
Other
329 stars 64 forks source link

On windows 12 getting crash with fprintf_s() with latest libsafec-3.5.1.a #94

Closed tharunkumarbandikolla closed 3 years ago

tharunkumarbandikolla commented 3 years ago

Hi Team,

We Included libsafec-3.5.1.a in our binaries. Its getting crash in the function fprintf_s() and its happening only in Windows 2k12 R2

Thanks, Tharun

DBJDBJ commented 3 years ago

R U sending messages from the future 😉

image

tharunkumarbandikolla commented 3 years ago

Sorry, i didn't understand that.

DBJDBJ commented 3 years ago

Sorry, i didn't understand that.

Windows 12 is not out yet :) Just kidding. I assume you meant Windows Server 2012.

Can you please post some code that is crashing each time you run it with libsafec-3.5.1a ? As small as possible, please.

rurban commented 3 years ago

Show us the usage where it crashes. All the args.

Some parts of fprintf_s are not implemented yet according to the specs. But on Windows I just use the native variant which behaves differently with buffers like %s.

DBJDBJ commented 3 years ago

Show us the usage where it crashes. All the args.

Some parts of fprintf_s are not implemented yet according to the specs. But on Windows, I just use the native variant which behaves differently with buffers like %s.

If you want to know what is really going on inside the WIN code and your C/C++ you need to use SEHand Minidumps.

The only feasible compiler in that scenario is cl.exe. Since in the context of "safe" on WIN32 one really wants to build using the /kernel switch.

Caveat Emptor: Be warned. MS Docs' current policy is to simply "erase" C. Ignore the C++ information skew if you can. Or simply use visual studio with clang-cl.exe . That works in 99% of use cases.

tharunkumarbandikolla commented 3 years ago

image

And we are not directly using the function, we are using this via libxml2 library functions.

tharunkumarbandikolla commented 3 years ago

Sorry, i think this might be an issue with libxml2 library itself.