Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix panic in table parser #462

Merged
merged 1 commit into from
Oct 12, 2024
Merged

Fix panic in table parser #462

merged 1 commit into from
Oct 12, 2024

Conversation

Andrew-Morozko
Copy link
Contributor

@Andrew-Morozko Andrew-Morozko commented Aug 15, 2024

Code in func (b *tableParagraphTransformer) parseRow used the segment's Value to calculate some offsets as if Value always corresponds 1 to 1 to the source. Segments with padding cause incorrect behavior generally, and an out-of-bounds source access in pathological cases.

I switched the code to use padding-aware segment.TrimLeftSpace and segment.TrimRightSpace instead of raw util.TrimLeftSpaceLength and util.TrimRightSpaceLength

@yuin yuin merged commit d80ac93 into yuin:master Oct 12, 2024
@Andrew-Morozko Andrew-Morozko deleted the table_fix branch October 17, 2024 16:27
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