Prevent infinite loops for corrupt options
This commit is contained in:
parent
bc7759d94c
commit
1c767711bb
@ -305,14 +305,19 @@ function optionsVersion(options) {
|
||||
];
|
||||
|
||||
optionsSetDefaults(options);
|
||||
if (!options.hasOwnProperty('version')) {
|
||||
options.version = fixups.length;
|
||||
|
||||
let version = options.version;
|
||||
if (typeof version !== 'number' || !Number.isFinite(version)) {
|
||||
version = fixups.length;
|
||||
} else {
|
||||
version = Math.max(0, Math.floor(version));
|
||||
}
|
||||
|
||||
while (options.version < fixups.length) {
|
||||
fixups[options.version++]();
|
||||
for (; version < fixups.length; ++version) {
|
||||
fixups[version]();
|
||||
}
|
||||
|
||||
options.version = version;
|
||||
return options;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user