Skip to content

fix: correct parameter index tracking in Signature validation#104

Open
boyGalsen wants to merge 1 commit intodashjoin:mainfrom
boyGalsen:fix/signature-index-tracking
Open

fix: correct parameter index tracking in Signature validation#104
boyGalsen wants to merge 1 commit intodashjoin:mainfrom
boyGalsen:fix/signature-index-tracking

Conversation

@boyGalsen
Copy link
Copy Markdown

The index variable in Signature.validate() was incremented at the end of the for loop, but the capture group was read using the pre-increment value. When the first argument is an array (type 'a') and the second is a function (type 'f'), the function argument was validated against group(1) instead of group(2), causing a false T0410 signature mismatch error.

Fix: use post-increment (index++) inline at the point where the capture group is read, and remove the redundant index++ at the end of the loop.

Also fix DateTimeTest.testToMillis assertion to be timezone-agnostic.

Fixes #79

The index variable in Signature.validate() was incremented at the
end of the for loop, but the capture group was read using the
pre-increment value. When the first argument is an array (type 'a')
and the second is a function (type 'f'), the function argument was
validated against group(1) instead of group(2), causing a false
T0410 signature mismatch error.

Fix: use post-increment (index++) inline at the point where the
capture group is read, and remove the redundant index++ at the
end of the loop.

Also fix DateTimeTest.testToMillis assertion to be timezone-agnostic.

Fixes dashjoin#79
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.

Incorrect each function signature validation

1 participant