File tree 1 file changed +13
-1
lines changed
src/librustdoc/html/static/js 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -446,6 +446,15 @@ function initSearch(rawSearchIndex) {
446
446
}
447
447
const posBefore = parserState . pos ;
448
448
getNextElem ( query , parserState , elems , endChar === ">" ) ;
449
+ if ( endChar !== "" ) {
450
+ if ( parserState . pos >= parserState . length ) {
451
+ throw new Error ( "Unclosed `<`" ) ;
452
+ }
453
+ const c2 = parserState . userQuery [ parserState . pos ] ;
454
+ if ( ! isSeparatorCharacter ( c2 ) && c2 !== endChar ) {
455
+ throw new Error ( `Expected \`${ endChar } \`, found \`${ c2 } \`` ) ;
456
+ }
457
+ }
449
458
// This case can be encountered if `getNextElem` encountered a "stop character" right
450
459
// from the start. For example if you have `,,` or `<>`. In this case, we simply move up
451
460
// the current position to continue the parsing.
@@ -454,7 +463,10 @@ function initSearch(rawSearchIndex) {
454
463
}
455
464
foundStopChar = false ;
456
465
}
457
- // We are either at the end of the string or on the `endChar`` character, let's move forward
466
+ if ( parserState . pos >= parserState . length && endChar !== "" ) {
467
+ throw new Error ( "Unclosed `<`" ) ;
468
+ }
469
+ // We are either at the end of the string or on the `endChar` character, let's move forward
458
470
// in any case.
459
471
parserState . pos += 1 ;
460
472
}
You can’t perform that action at this time.
0 commit comments