Skip to content

Commit 99abe6a

Browse files
authored
Merge pull request #427 from bazsi/cfg-source-fix-lines-array-overflow
cfg-source: avoid indexing over the end of the lines array
2 parents f80c820 + 1b426ca commit 99abe6a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/cfg-source.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ _extract_source_from_buffer_location(GString *result, const gchar *buffer_conten
237237
if (yylloc->first_column < 1)
238238
goto exit;
239239

240-
for (gint lineno = yylloc->first_line; lineno <= yylloc->last_line; lineno++)
240+
for (gint lineno = yylloc->first_line; lineno < num_lines && lineno <= yylloc->last_line; lineno++)
241241
{
242242
gchar *line = lines[lineno - 1];
243243
gint linelen = strlen(line);

0 commit comments

Comments
 (0)