]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix RangeError exception when merging too many labels (#5936)
authorCK <ckyycc@users.noreply.github.com>
Mon, 31 Dec 2018 12:35:51 +0000 (04:35 -0800)
committerSimon Brunel <simonbrunel@users.noreply.github.com>
Mon, 31 Dec 2018 12:35:51 +0000 (13:35 +0100)
Fix "RangeError: Maximum call stack size exceeded" exception when calling `Array.push.apply` with too many items (>125000).

src/scales/scale.time.js

index a2892bfd6cd55b146e8c9c6c556afa48f618343e..099e5717e9a97e264a05cde0dad51c3e91ec0ab4 100644 (file)
@@ -554,7 +554,9 @@ module.exports = function() {
                                                        datasets[i][j] = timestamp;
                                                }
                                        } else {
-                                               timestamps.push.apply(timestamps, labels);
+                                               for (j = 0, jlen = labels.length; j < jlen; ++j) {
+                                                       timestamps.push(labels[j]);
+                                               }
                                                datasets[i] = labels.slice(0);
                                        }
                                } else {