Skip to content

Preserve long precision in block-attack constant comparisons - #7223

Merged
miemieYaho merged 6 commits into
baomidou:3.0from
wozhenbang2004:patch-1
Nov 2, 2026
Merged

miemieYaho merged 6 commits into
baomidou:3.0from
wozhenbang2004:patch-1

Conversation

@wozhenbang2004

Copy link
Copy Markdown
Contributor

BlockAttackInnerInterceptor converts integer constants to double before comparing them. Above 2^53, distinct long values can become equal: 9007199254740992 <> 9007199254740993 is classified as false even though it is true. This can let a constant-true UPDATE/DELETE condition pass the full-table check; the corresponding false equality is incorrectly rejected.

Compare two Long operands with Long.compare in all four parser variants. Floating-point and mixed-number comparisons retain their existing behavior.

The shared regressions cover UPDATE and DELETE, adjacent values above 2^53 and near Long.MAX_VALUE, all comparison operators, and AND/OR/NOT combinations. Restrictive column conditions remain permitted.

Validation against upstream e88aac9:

  • Compiled each actual interceptor source and both shared interceptor test classes, then ran them with JUnit using parser 4.9, 5.0, 5.2 and 5.4 separately.
  • Unmodified production code: the two new tests fail in every variant; the other 12 tests pass.
  • Patched production code: 14/14 tests pass in every variant (56 total).
  • The isolated runs use Java 17 and published MyBatis-Plus 3.5.18.1 dependencies. They do not establish a full Gradle build or project-wide CI pass. The Gradle wrapper did not reach compilation because its distribution download failed in this environment.

@miemieYaho
miemieYaho merged commit ea3d6c6 into baomidou:3.0 Nov 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants