Widen tls upper bound to allow tls 2.4.x#77
Closed
jappeace-sloth wants to merge 4 commits intowinterland1989:masterfrom
Closed
Widen tls upper bound to allow tls 2.4.x#77jappeace-sloth wants to merge 4 commits intowinterland1989:masterfrom
jappeace-sloth wants to merge 4 commits intowinterland1989:masterfrom
Conversation
Replace unsafeDrop, unsafeTail, and unsafeIndex with safe bounded alternatives in text protocol parsers (MySQLValue.hs), add a precision >= scale guard for NEWDECIMAL in BinLogValue.hs, and add bounds checking to eventHeaderLen in BinLogEvent.hs. The unsafe operations caused undefined behavior (reading garbage memory, segfaults) when receiving malformed data from the MySQL wire protocol. The safe alternatives are also O(1) — the only cost is a single integer comparison per call. Changes: - MySQLValue.hs: Add guards before B.tail/B.drop in dateParser, timeParser, timestamp/datetime, and time field parsers - BinLogValue.hs: Guard precision >= scale in NEWDECIMAL to prevent Word8 underflow causing out-of-bounds sizeTable access - BinLogEvent.hs: Bounds check in eventHeaderLen to handle unknown event types (negative index) gracefully by returning 0 - Add test/BoundsCheck.hs with 8 regression tests covering all fixed code paths Prompt: Implement plan to fix unsafe bounds in mysql-haskell (TDD) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The old timestamp/datetime tests used "abc" and "" as inputs. readDecimal returns Nothing on non-numeric input, which short-circuits via Maybe's Applicative instance before unsafeDrop is ever forced (lazy evaluation). These tests passed even without the fix. Replace with inputs where dateParser succeeds but the string is too short for the subsequent unsafeDrop 11: - "2024-01-01" (10 bytes) — dateParser succeeds, unsafeDrop 11 is UB - "2024-01-01 1" (12 bytes) — dateParser succeeds, unsafeDrop 11 gives "1", timeParser reads hour, then unsafeTail on "" is UB Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add ^>=2.4.0 to tls dependency bounds. Bump version 1.2.2 -> 1.2.3. Prompt: repair bounds for these packages, make it tls <2.5.0, do a patch bump and update the changelog Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
^>=2.4.0totlsdependency bounds to allow tls 2.4.xTest plan
🤖 Generated with Claude Code