Skip to content

Fix: Avoid end_offset overflows - #1

Merged
heyvito merged 2 commits into
masterfrom
fix/overflow
Nov 27, 2025
Merged

Fix: Avoid end_offset overflows#1
heyvito merged 2 commits into
masterfrom
fix/overflow

Conversation

@ofeefo

@ofeefo ofeefo commented Nov 27, 2025

Copy link
Copy Markdown
Collaborator

This pull request addresses a potential bug in the YAML editor by ensuring that the YAML data always ends with a trailing newline, and adds a regression test to prevent end offset overflow errors when updating YAML values.

Bug fix for YAML data handling:

  • Ensures that the @data string in PatchYAML::Editor#reload always ends with a newline character to prevent parsing issues, which could lead to end offset errors. (lib/patchyaml/editor.rb)

Testing and regression prevention:

  • Adds a regression test in regression_spec.rb to verify that updating a YAML structure does not cause an end offset overflow, and that the output remains correct. (spec/regression_spec.rb)

@heyvito

heyvito commented Nov 27, 2025

Copy link
Copy Markdown
Owner

Merging with errors, RuboCop offenses will be fixed later on.

Thanks @ofeefo!

@heyvito
heyvito merged commit 260b6cc into master Nov 27, 2025
1 check failed
@heyvito
heyvito deleted the fix/overflow branch November 27, 2025 14:14
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