DEV Community

Aivars Kalvāns
Aivars Kalvāns

Posted on • Originally published at aivarsk.com on

Debugging Boolean Expressions of Fielded Buffers

I described the SIGFPE bomb of Boolean Expressions before. Going through the list of the C functions I was reminded of the Fboolpr32 function that prints the expression tree as it was parsed. Ten minutes later I had added it to the Python Tuxedo library. So let us look at the SIGFPE bomb again:

>>> import tuxedo as t
>>> t.Fboolev32({"TA_STATUS": "OK123"}, "TA_STATUS %! 'OK.*'")
Floating-point exception

Enter fullscreen mode Exit fullscreen mode

Now we can investigate and verify how it was parsed by Oracle Tuxedo:

>>> t.Fboolpr32("TA_STATUS %! 'OK.*'", sys.stdout)
( ( TA_STATUS[0] ) % ( ! ( 'OK.*' ) ) )

Enter fullscreen mode Exit fullscreen mode

Indeed, it is interpreted as the % modulo operation and ! negation. And here is what the developer intended to write:

>>> t.Fboolpr32("TA_STATUS !% 'OK.*'", sys.stdout)
( ( TA_STATUS[0] ) !% ( 'OK.*' ) )

Enter fullscreen mode Exit fullscreen mode

P.S. I have even implemented the Fboolpr32 function for my Open Source replacement of Oracle Tuxedo

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay