Skip to content
Heist/ feed
Back to feed
High

Vyper has incorrect storage layout for contracts containing large arrays

Type: advisorySources: OSV

Vyper is a Pythonic Smart Contract Language for the Ethereum Virtual Machine (EVM). Contracts containing large arrays might underallocate the number of slots they need by 1. Prior to v0.3.8, the calculation to determine how many slots a storage variable needed used `math.ceil(type_.size_in_bytes / 32)`. The intermediate floating point step can produce a rounding error if there are enough bits set in the IEEE-754 mantissa. Roughly speaking, if `type_.size_in_bytes` is large (> 2**46), and slightly less than a power of 2, the calculation can overestimate how many slots are needed by 1. If `type_.size_in_bytes` is slightly more than a power of 2, the calculation can underestimate how many slots are needed by 1. This issue is patched in version 0.3.8.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2023-46247
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 01:18 UTC · Revision 1

Source evidence

Vyper has incorrect storage layout for contracts containing large arrays

core-osv · Original source

Published 13 Dec 2023, 19:39 UTC

Vyper is a Pythonic Smart Contract Language for the Ethereum Virtual Machine (EVM). Contracts containing large arrays might underallocate the number of slots they need by 1. Prior to v0.3.8, the calculation to determine how many slots a storage variable needed used `math.ceil(type_.size_in_bytes / 32)`. The intermediate floating point step can produce a rounding error if there are enough bits set in the IEEE-754 mantissa. Roughly speaking, if `type_.size_in_bytes` is large (> 2**46), and slightly less than a power of 2, the calculation can overestimate how many slots are needed by 1. If `type_.size_in_bytes` is slightly more than a power of 2, the calculation can underestimate how many slots are needed by 1. This issue is patched in version 0.3.8.

osv:CVE-2023-46247
Complete source record
{
  "id": "31e7920888da77c1bdf8eb1680d3a16805d19a43ca07694c188f58231c46f025",
  "url": "https://osv.dev/vulnerability/CVE-2023-46247",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Vyper has incorrect storage layout for contracts containing large arrays",
    "summary": "Vyper is a Pythonic Smart Contract Language for the Ethereum Virtual Machine (EVM). Contracts containing large arrays might underallocate the number of slots they need by 1. Prior to v0.3.8, the calculation to determine how many slots a storage variable needed used `math.ceil(type_.size_in_bytes / 32)`. The intermediate floating point step can produce a rounding error if there are enough bits set in the IEEE-754 mantissa. Roughly speaking, if `type_.size_in_bytes` is large (> 2**46), and slightly less than a power of 2, the calculation can overestimate how many slots are needed by 1. If `type_.size_in_bytes` is slightly more than a power of 2, the calculation can underestimate how many slots are needed by 1. This issue is patched in version 0.3.8.",
    "evidence": "osv:CVE-2023-46247",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2023-46247",
      "aliases": [
        "CVE-2023-46247",
        "GHSA-6m97-7527-mh74",
        "PYSEC-2023-307"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/vyperlang/vyper",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "036f153683e0d55b890305eb4c77680a0872fcba"
                },
                {
                  "fixed": "0bb7203b584e771b23536ba065a6efda457161bb"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:vyperlang:vyper:*:*:*:*:*:python:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "0.3.8"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "0bb7203b584e771b23536ba065a6efda457161bb"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "v0.3.7",
            "v0.3.6",
            "v0.3.5",
            "v0.3.4",
            "pre-release",
            "v0.3.3",
            "v0.3.2",
            "v0.3.1",
            "v0.3.0",
            "v0.2.16",
            "v0.2.15",
            "v0.2.14",
            "v0.2.13",
            "v0.2.12",
            "v0.2.11",
            "v0.2.10",
            "v0.2.9",
            "v0.2.8",
            "v0.2.7",
            "v0.2.6",
            "v0.2.5",
            "v0.2.4",
            "v0.2.3",
            "v0.2.2",
            "v0.2.1",
            "0.2.1",
            "v0.2.0",
            "v0.1.0-beta.17",
            "v0.1.0-beta.16",
            "v0.1.0-beta.15",
            "v0.1.0-beta.14",
            "v0.1.0-beta.13",
            "v0.1.0-beta.12",
            "v0.1.0-beta.11",
            "v0.1.0-beta.10",
            "v0.1.0-beta.9",
            "v0.1.0-beta.8",
            "v0.1.0-beta.7",
            "v0.1.0-beta.6",
            "v0.1.0-beta.5",
            "v0.1.0-beta.3",
            "v0.1.0-beta.2",
            "v0.1.0-beta.1",
            "v0.0.4"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-46247.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:32.625307013Z",
      "provider": "osv",
      "references": [
        "https://github.com/vyperlang/vyper/blob/6020b8bbf66b062d299d87bc7e4eddc4c9d1c157/vyper/semantics/validation/data_positions.py#L197",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/46xxx/CVE-2023-46247.json",
        "https://github.com/vyperlang/vyper/security/advisories/GHSA-6m97-7527-mh74",
        "https://nvd.nist.gov/vuln/detail/CVE-2023-46247",
        "https://github.com/vyperlang/vyper/commit/0bb7203b584e771b23536ba065a6efda457161bb"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-193",
          "CWE-682"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/46xxx/CVE-2023-46247.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2023-46247",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 499423,
  "published_at": "2023-12-13T19:39:22.626+00:00"
}