Skip to content

Commit 84abf89

Browse files
Stop searching at the previous offset to prevent quadratic behavior.
1 parent 6a6e335 commit 84abf89

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

extensions/table.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static table_row *row_from_string(cmark_syntax_extension *self,
157157
cell->start_offset = offset;
158158
cell->end_offset = offset + cell_matched - 1;
159159

160-
while (cell->start_offset > 0 && string[cell->start_offset - 1] != '|') {
160+
while (cell->start_offset > row->paragraph_offset && string[cell->start_offset - 1] != '|') {
161161
--cell->start_offset;
162162
++cell->internal_offset;
163163
}

0 commit comments

Comments
 (0)