ModSecurity icon indicating copy to clipboard operation
ModSecurity copied to clipboard

V3/remove this throw call transaction h

Open gberkes opened this issue 1 year ago • 4 comments

Introducing the use of assertions to address throw; calls that lack try-catch blocks. Upon examining the caller code that utilized methods containing the questioned throw; calls, it became clear that, in the current state of development, there are no scenarios where execution could reach these throw; calls. However, we cannot guarantee this for future development. For instance, if someone attempts to use getCurrentMarker() without first verifying isInsideAMarker(), ModSecurity would encounter the throw; and terminate. The issue with the other throw; call is similar in that it is, fortunately, unreachable at the moment. However, it differs because this throw; is intended to handle a case that has not yet been developed.

Fortunately, I found an article titled "Effective Use of Assertions in C++" by Mike A. Martin in (ACM SIGPLAN Language Tips, page 3), which offers a neat way to handle such cases, specifically regarding argument validation and unreachable code. Link to the article.

Following the guidance from this article, I addressed the issues and also included modifications to enrich assert error messages. Furthermore, I updated configure.ac to maintain the usual build procedure and modified README.md to introduce the new configure flag.

gberkes avatar Mar 06 '24 11:03 gberkes

Just for the record: this PR fixes two SonarCloud issues in files:

I also added these references as conversation.

airween avatar Mar 29 '24 10:03 airween

Please pull the modifications from #3134, and apply this PR. Or you can resolve the conflicts here.

airween avatar May 03 '24 13:05 airween

@gberkes Could you please address requested change to complete this issue?

huberts90 avatar Jun 07 '24 14:06 huberts90