goldmark icon indicating copy to clipboard operation
goldmark copied to clipboard

Fix panic in table parser

Open Andrew-Morozko opened this issue 6 months ago • 0 comments

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

Andrew-Morozko avatar Aug 15 '24 19:08 Andrew-Morozko