Page 1 of 1

C Backend Purifier doesn't detect the overflow

Posted: Wed Aug 04, 2021 1:00 am
by chi
With ASM + Purifier the following code throws an overflow error, but with C + Purifier the overflow won't be detected.

Code: Select all

screen.POINT

hWndScintilla = $80696 ;use Spy++, WinSpy++, ...

SendMessageTimeout_(hWndScintilla, #SCI_GETCURRENTPOS, 0, 0, #SMTO_ABORTIFHUNG, 2000, @CurrentPos)

SendMessageTimeout_(hWndScintilla, #SCI_POINTXFROMPOSITION, 0, CurrentPos, #SMTO_ABORTIFHUNG, 2000, @screen\x)
SendMessageTimeout_(hWndScintilla, #SCI_POINTYFROMPOSITION, 0, CurrentPos, #SMTO_ABORTIFHUNG, 2000, @screen\y)

MessageRequester("", "x:" + screen\x + " y:" + screen\y)

Re: C Backend Purifier doesn't detect the overflow

Posted: Thu Aug 05, 2021 8:32 am
by Fred
Unfortunately the purifier isn't as good with the C backend, as we can't check local variable overflow. The good news is we should now be able to use C specific tools like Valgrind or Purify when compiling in debug mode with symbols.

Re: C Backend Purifier doesn't detect the overflow

Posted: Thu Aug 19, 2021 5:02 pm
by chi
Valgrind is Linux only and Purify/PurifyPlus is kinda pricey (+ annual). Found a nice solution with MSVC, though. /RTCs does pretty much the same :D

Re: C Backend Purifier doesn't detect the overflow

Posted: Mon Nov 28, 2022 5:10 am
by nsstudios
I have somehow totally missed this, and realized that c backend wasn't catching overflows just recently. :(
Is this something that is planned to be improved in the future, maybe with a tool shipped with PB itself?
It's easy to verify a program that doesn't use inline C with asm compiler/purifier, but it's not so easy to do that if you have inline c code.

Re: C Backend Purifier doesn't detect the overflow

Posted: Thu Feb 01, 2024 2:43 am
by Quin
Bumping this. Is this ever planned to be improved? This feels like a fairly serious current limitation of the C backend.
nsstudios wrote: Mon Nov 28, 2022 5:10 am I have somehow totally missed this, and realized that c backend wasn't catching overflows just recently. :(
Is this something that is planned to be improved in the future, maybe with a tool shipped with PB itself?
It's easy to verify a program that doesn't use inline C with asm compiler/purifier, but it's not so easy to do that if you have inline c code.

Re: C Backend Purifier doesn't detect the overflow

Posted: Thu Feb 01, 2024 10:27 am
by Caronte3D
I think you can compile with the ASM backend to use Purifier and then when your code is good, finally compile with the C backend, right :?:

Re: C Backend Purifier doesn't detect the overflow

Posted: Thu Feb 01, 2024 3:23 pm
by Quin
What if you have inline C?
Caronte3D wrote: Thu Feb 01, 2024 10:27 am I think you can compile with the ASM backend to use Purifier and then when your code is good, finally compile with the C backend, right :?: