]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Limit pixel values to 32bit integer range (#7800)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Tue, 15 Sep 2020 19:33:59 +0000 (22:33 +0300)
committerGitHub <noreply@github.com>
Tue, 15 Sep 2020 19:33:59 +0000 (15:33 -0400)
src/core/core.scale.js
src/helpers/helpers.math.js

index c8fc02bbcb166799ecdc69920d8ab1d09b2ffa95..ae3a2697c20de9320999146ab930c20a8e434ec3 100644 (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);
        }
 
        /**
index b01c9b292ce07d038aaf9c5b8f036b9007288379..2fc9043c11e4cd67a00e052ed5c33391b4d8a278 100644 (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);
+}