Skip to content

Class SQLParser misparses C-style escape sequences? #231

@hartwork

Description

@hartwork

Hi!

This is related to #223. While skip-reading through related code, it came to my attention that the code at…

private parseSingleQuotedString(): void {
this.pos++; // Skip opening quote
while (this.pos < this.len) {
const char = this.input[this.pos];
if (char === "'") {
this.pos++;
return;
} else if (char === '\\') {
this.pos += 2; // Skip escaped character
} else {
this.pos++;
}
}
throw new Error('Unterminated single-quoted string');
}
private parseDoubleQuotedString(): void {
this.pos++; // Skip opening quote
while (this.pos < this.len) {
const char = this.input[this.pos];
if (char === '"') {
this.pos++;
return;
} else if (char === '\\') {
this.pos += 2; // Skip escaped character
} else {
this.pos++;
}
}
throw new Error('Unterminated double-quoted string');
}

…seems to mishandle numeric escape sequences of than 2 characters:

Image

I have not checked for the consequences of this issue.

Best, Sebastian

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions