Skip to content

Commit

Permalink
Merge pull request #1019 from mathjax/issue3129
Browse files Browse the repository at this point in the history
Have \unicode check for illegal font name.  (mathjax/MathJax#3129)
  • Loading branch information
dpvc authored Nov 20, 2023
2 parents dd7481c + e652ec3 commit 42437fb
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 42437fb

Please sign in to comment.