Prevent infinite loops for corrupt options
This commit is contained in:
parent
bc7759d94c
commit
1c767711bb
@ -305,14 +305,19 @@ function optionsVersion(options) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
optionsSetDefaults(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) {
|
for (; version < fixups.length; ++version) {
|
||||||
fixups[options.version++]();
|
fixups[version]();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
options.version = version;
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user