mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Fix crash in parseJsxChild found by fuzzing (#53674)
This commit is contained in:
parent
bebb6d0086
commit
f243b987af
@ -6013,7 +6013,7 @@ namespace Parser {
|
||||
// We want the error span to cover only 'Foo.Bar' in < Foo.Bar >
|
||||
// or to cover only 'Foo' in < Foo >
|
||||
const tag = openingTag.tagName;
|
||||
const start = skipTrivia(sourceText, tag.pos);
|
||||
const start = Math.min(skipTrivia(sourceText, tag.pos), tag.end);
|
||||
parseErrorAt(start, tag.end, Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, getTextOfNodeFromSourceText(sourceText, openingTag.tagName));
|
||||
}
|
||||
return undefined;
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
tests/cases/compiler/a.js(1,3): error TS17008: JSX element '' has no corresponding closing tag.
|
||||
tests/cases/compiler/a.js(1,4): error TS1003: Identifier expected.
|
||||
tests/cases/compiler/a.js(1,5): error TS1005: '...' expected.
|
||||
tests/cases/compiler/a.js(3,1): error TS1005: '</' expected.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.js (4 errors) ====
|
||||
!< {:>
|
||||
|
||||
!!! error TS17008: JSX element '' has no corresponding closing tag.
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
~
|
||||
!!! error TS1005: '...' expected.
|
||||
|
||||
|
||||
|
||||
!!! error TS1005: '</' expected.
|
||||
@ -0,0 +1,9 @@
|
||||
//// [a.js]
|
||||
!< {:>
|
||||
|
||||
|
||||
|
||||
//// [a.js]
|
||||
!< {...}>
|
||||
|
||||
</>;
|
||||
@ -0,0 +1,5 @@
|
||||
=== tests/cases/compiler/a.js ===
|
||||
|
||||
!< {:>
|
||||
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
=== tests/cases/compiler/a.js ===
|
||||
!< {:>
|
||||
>!< {:> : boolean
|
||||
>< {:> : any
|
||||
> : any
|
||||
> : any
|
||||
|
||||
|
||||
> : any
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
// @allowJs: true
|
||||
// @outDir: ./out
|
||||
// @filename: a.js
|
||||
!< {:>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user