Skip to content

Commit c816a69

Browse files
committed
COMMON: Fix crash when line length limit exceeded
1 parent fa37beb commit c816a69

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2021-01-18 (12.21)
2+
COMMON: Fix crash when line length limit exceeded
3+
14
2021-01-18 (12.21)
25
COMMON: Handle octal escapes correctly
36

src/common/scan.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4651,6 +4651,7 @@ int comp_pass1(const char *section, const char *text) {
46514651

46524652
char *ps = new_text;
46534653
char *p = ps;
4654+
int line_size = 0;
46544655
while (*p) {
46554656
if (*p == '\n') {
46564657
// proceed
@@ -4669,11 +4670,17 @@ int comp_pass1(const char *section, const char *text) {
46694670
break;
46704671
}
46714672
ps = p + 1;
4673+
line_size = 0;
46724674
}
46734675
if (comp_error) {
46744676
break;
46754677
}
46764678
p++;
4679+
if (++line_size >= SB_SOURCELINE_SIZE) {
4680+
*p = '\0';
4681+
sc_raise(ERR_LINE_LENGTH, p - 50);
4682+
break;
4683+
}
46774684
}
46784685
}
46794686

src/languages/messages.en.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,4 @@
229229
#define ERR_DIRWALK_NAME "DIRWALK: name %s/%s too long"
230230
#define ERR_DIRWALK_MISSING_USE "DIRWALK: missing USE statement"
231231
#define ERR_DIRWALK_CANT_OPEN "DIRWALK: can't open %s"
232+
#define ERR_LINE_LENGTH "Line length limit exceeded at text: '%s'"

0 commit comments

Comments
 (0)