@dicebear/core 9.4.1 → 9.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/utils/prng.js CHANGED
@@ -1,5 +1,6 @@
1
1
  const MIN = -2147483648;
2
2
  const MAX = 2147483647;
3
+ const MAX_SEED_LENGTH = 1024;
3
4
  function xorshift(value) {
4
5
  value ^= value << 13;
5
6
  value ^= value >> 17;
@@ -15,8 +16,8 @@ function hashSeed(seed) {
15
16
  return hash;
16
17
  }
17
18
  export function create(seed = '') {
18
- // Ensure that seed is a string
19
- seed = seed.toString();
19
+ // Ensure that seed is a string and limit length to prevent CPU exhaustion
20
+ seed = seed.toString().slice(0, MAX_SEED_LENGTH);
20
21
  let value = hashSeed(seed) || 1;
21
22
  const next = () => (value = xorshift(value));
22
23
  const integer = (min, max) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dicebear/core",
3
- "version": "9.4.1",
3
+ "version": "9.4.2",
4
4
  "description": "An avatar library for designers and developers.",
5
5
  "keywords": [
6
6
  "avatar",