Skip to content

Commit

Permalink
Have \unicode check for illegal font name. (mathjax/MathJax#3129)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpvc committed Nov 13, 2023
1 parent 09c4698 commit e652ec3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ts/input/tex/unicode/UnicodeConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ let UnicodeCache: {[key: number]: [number, number, string, number]} = {};
UnicodeMethods.Unicode = function(parser: TexParser, name: string) {
let HD = parser.GetBrackets(name);
let HDsplit = null;
let font = null;
let font = '';
if (HD) {
if (HD.replace(/ /g, '').
match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/)) {
Expand All @@ -56,6 +56,9 @@ UnicodeMethods.Unicode = function(parser: TexParser, name: string) {
font = HD;
}
}
if (font.match(/;/)) {
throw new TexError('BadFont', 'Font name for %1 can\'t contain semicolons', parser.currentCS);
}
let n = ParseUtil.trimSpaces(parser.GetArgument(name)).replace(/^0x/, 'x');
if (!n.match(/^(x[0-9A-Fa-f]+|[0-9]+)$/)) {
throw new TexError('BadUnicode', 'Argument to %1 must be a number', parser.currentCS);
Expand Down

0 comments on commit e652ec3

Please sign in to comment.