Skip to content

Commit

Permalink
Prevent GridTableParser from looking beyond the end of a line.
Browse files Browse the repository at this point in the history
  • Loading branch information
snnz committed Jan 3, 2025
1 parent d1233ff commit 118d28f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Markdig/Extensions/Tables/GridTableParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,15 @@ private BlockState HandleNewRow(BlockProcessor processor, GridTableState tableSt
private static void SetRowSpanState(List<GridTableState.ColumnSlice> columns, StringSlice line, out bool isHeaderRow, out bool hasRowSpan)
{
var lineStart = line.Start;
var lineEnd = line.End;
isHeaderRow = line.PeekChar() == '=' || line.PeekChar(2) == '=';
hasRowSpan = false;
foreach (var columnSlice in columns)
{
if (columnSlice.CurrentCell != null)
{
line.Start = lineStart + columnSlice.Start + 1;
line.End = lineStart + columnSlice.End - 1;
line.End = Math.Min(lineStart + columnSlice.End - 1, lineEnd);
line.Trim();
if (line.IsEmptyOrWhitespace() || !IsRowSeparator(line))
{
Expand Down

0 comments on commit 118d28f

Please sign in to comment.