C Backend Purifier doesn't detect the overflow

Just starting out? Need help? Post your questions and find answers here.
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

C Backend Purifier doesn't detect the overflow

Post 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)
Et cetera is my worst enemy
Fred
Administrator
Administrator
Posts: 16621
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: C Backend Purifier doesn't detect the overflow

Post 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.
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: C Backend Purifier doesn't detect the overflow

Post 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
Et cetera is my worst enemy
nsstudios
Enthusiast
Enthusiast
Posts: 274
Joined: Wed Aug 28, 2019 1:01 pm
Location: Serbia
Contact:

Re: C Backend Purifier doesn't detect the overflow

Post 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.
Quin
Enthusiast
Enthusiast
Posts: 286
Joined: Thu Mar 31, 2022 7:03 pm
Location: United States
Contact:

Re: C Backend Purifier doesn't detect the overflow

Post 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.
PB v5.40/6.10, Windows 10 64-bit.
16-core AMD Ryzen 9 5950X, 128 GB DDR5.
User avatar
Caronte3D
Addict
Addict
Posts: 1029
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: C Backend Purifier doesn't detect the overflow

Post 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 :?:
Quin
Enthusiast
Enthusiast
Posts: 286
Joined: Thu Mar 31, 2022 7:03 pm
Location: United States
Contact:

Re: C Backend Purifier doesn't detect the overflow

Post 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 :?:
PB v5.40/6.10, Windows 10 64-bit.
16-core AMD Ryzen 9 5950X, 128 GB DDR5.
Post Reply