Limit pixel values to 32bit integer range (#7800)

This commit is contained in:
Jukka Kurkela 2020-09-15 22:33:59 +03:00 committed by GitHub
parent 2c5db2c350
commit 17e27e16cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -2,7 +2,7 @@ import defaults from './core.defaults';
import Element from './core.element';
import {_alignPixel, _measureText} from '../helpers/helpers.canvas';
import {callback as call, each, isArray, isFinite, isNullOrUndef, isObject, valueOrDefault} from '../helpers/helpers.core';
import {_factorize, toDegrees, toRadians} from '../helpers/helpers.math';
import {_factorize, toDegrees, toRadians, _int32Range} from '../helpers/helpers.math';
import {toFont, resolve, toPadding} from '../helpers/helpers.options';
import Ticks from './core.ticks';
@ -981,7 +981,7 @@ export default class Scale extends Element {
decimal = 1 - decimal;
}
return me._startPixel + decimal * me._length;
return _int32Range(me._startPixel + decimal * me._length);
}
/**

View File

@ -172,3 +172,7 @@ export function _angleBetween(angle, start, end) {
export function _limitValue(value, min, max) {
return Math.max(min, Math.min(max, value));
}
export function _int32Range(value) {
return _limitValue(value, -2147483648, 2147483647);
}