mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
[PR #710] [MERGED] Add line count check to avoid out of range #1194
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/xoofx/markdig/pull/710
Author: @valterc
Created: 4/18/2023
Status: ✅ Merged
Merged: 4/22/2023
Merged by: @xoofx
Base:
master← Head:fix-line-group-oob📝 Commits (3)
a911877Added line count check to avoid out of boundscd5d11eFix index check512b282Improved tests📊 Changes
3 files changed (+65 additions, -3 deletions)
View changed files
📝
src/Markdig.Tests/TestStringSliceList.cs(+35 -0)📝
src/Markdig.Tests/TestYamlFrontMatterExtension.cs(+24 -0)📝
src/Markdig/Helpers/StringLineGroup.cs(+6 -3)📄 Description
IndexOutOfRangeException is thrown in StringLineGroup when calling Iterator.NextChar
8155a1e3d6/src/Markdig/Helpers/StringLineGroup.cs (L276)The exception occurs when trying to advance to the next line when the StringLineGroup is at capacity (capacity == line_count)
8155a1e3d6/src/Markdig/Helpers/StringLineGroup.cs (L339)This exception is kind of an edge case and does not happen often because
LeafBlockand other parts that use the StringLineGroup provision some extra capacity in advance and when capacity is needed it is increased by a factor of 2, so it's not very common that the needed capacity matches the line count.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.