Skip to content

ObjectScript scanners pass a null empty-state buffer to memcpy #2799

Open

Description

@WarGloom

ObjectScript routine and UDL external scanners unconditionally call memcpy(payload, buffer, length) during deserialization. The vendored Tree-sitter runtime initializes the deserialization input to data = NULL, length = 0 when no external scanner state exists, then calls the language scanner with that input. Passing NULL to memcpy is undefined even when the copy length is zero.

On main 6efe33b7, compiling each actual scanner with -fsanitize=undefined -fno-sanitize-recover=all and calling its exported deserialize function after create with (payload, NULL, 0) exits 1: runtime error: null pointer passed as argument 2, which is declared to never be null. Routine fails at scanner.c:118; UDL at scanner.c:122. Guarding the copy with if (length > 0) makes both cases pass and preserves nonempty serialized-state round trips.

Expected: accept Tree-sitter's empty-state callback without a sanitizer error while retaining nonempty deserialization behavior.

Related: #2368 already includes equivalent guards within a broader grammar re-vendor for Python bodies. A separate minimal sanitizer patch can land independently; it should add focused regression coverage and record both local patches in the vendoring manifest/checksums.

AI assistance: OpenAI Codex investigated and prepared this report on behalf of WarGloom.

Activity

  1. added
    bugSomething isn't working
    parsing/qualityGraph extraction bugs, false positives, missing edges
    and removed
    editor/integrationEditor compatibility and CLI integration
    on Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edges

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions