avoid infinite loops
This commit is contained in:
parent
cc9bfe2c00
commit
a80ed87b0c
@ -285,6 +285,11 @@ block.token = function(src, tokens, top) {
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
if (src) {
|
||||
throw new
|
||||
Error('Infinite loop on byte: ' + src.charCodeAt(0));
|
||||
}
|
||||
}
|
||||
|
||||
return tokens;
|
||||
@ -465,6 +470,11 @@ inline.lexer = function(src) {
|
||||
out += escape(cap[0]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (src) {
|
||||
throw new
|
||||
Error('Infinite loop on byte: ' + src.charCodeAt(0));
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
@ -704,7 +714,15 @@ noop.exec = noop;
|
||||
|
||||
function marked(src, opt) {
|
||||
setOptions(opt);
|
||||
try {
|
||||
return parse(block.lexer(src));
|
||||
} catch (e) {
|
||||
e.message += '\nPlease report this to https://github.com/chjj/marked.';
|
||||
if (marked.options.silent) {
|
||||
return 'An error occured: ' + e.message;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user