Skip to content

Fix for crash on windows in quota.c - #936

Open
PaulLodge wants to merge 3 commits into
apache:trunkfrom
PaulLodge:port-dav
Open

PaulLodge wants to merge 3 commits into
apache:trunkfrom
PaulLodge:port-dav

Conversation

@PaulLodge

Copy link
Copy Markdown

Fix for crash on windows

Crash (STATUS_ACCESS_VIOLATION / 0xC0000005) on all DAV write operations targeting
non-existent resources (PUT to new file, COPY/MOVE to new destination, MKCOL):

dav_fs_quota_precondition() in modules/dav/fs/quota.c called dav_fs_fname(src/dst)
to get the filesystem path

dav_fs_fname() returns resource->info->finfo.fname — APR's stat result

On Windows, apr_stat() calls fillin_fileinfo() which does memset(finfo, '\0', ...),
zeroing finfo->fname = NULL when the file doesn't exist

On Linux, apr_stat() sets finfo->fname = fname (the input path) even when stat succeeds,
but for non-existent resources Apache pre-assigns r->finfo.fname from r->filename,
so it is non-NULL

ap_make_dirstr_parent(pool, NULL) → ap_strrchr_c(NULL, '/') → crash

The crash has been verified by hand to ensure that the AI produced a
correct analysis the associated tests pass as expected, both on Linux
which was not affected, and on Windows.

Co-Authored-By: BOB BOB@ibm.com


  • This PR does not report or address a security vulnerability
    (see SECURITY.md and
    https://www.apache.org/security/#reporting-a-vulnerability).
  • Code follows the httpd style guide.
  • New log messages (level debug or higher) use an empty APLOGNO() tag;
    numbers are assigned by a committer at merge time (see docs/log-message-tags/README).
  • If the change is user-visible, a changes-entries/*.txt file is included,
    following the template in README.CHANGES (not needed otherwise).
  • Test cases based on pyhttpd are included where appropriate, in the
    test/modules/xxx directory matching the modules/xxx module source,
    or test/modules/core for core server changes. On Unix, verify these
    pass locally with e.g. make check-pytest PYTEST_DIRS=test/modules/xxx.

PaulLodge and others added 3 commits November 3, 2026 17:58
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
    Crash (STATUS_ACCESS_VIOLATION / 0xC0000005) on all DAV write operations targeting
    non-existent resources (PUT to new file, COPY/MOVE to new destination, MKCOL):

    dav_fs_quota_precondition() in modules/dav/fs/quota.c called dav_fs_fname(src/dst)
    to get the filesystem path

    dav_fs_fname() returns resource->info->finfo.fname — APR's stat result
    On Windows, apr_stat() calls fillin_fileinfo() which does memset(finfo, '\0', ...),
    zeroing finfo->fname = NULL when the file doesn't exist

    On Linux, apr_stat() sets finfo->fname = fname (the input path) even when stat succeeds,
    but for non-existent resources Apache pre-assigns r->finfo.fname from r->filename,
    so it is non-NULL

    ap_make_dirstr_parent(pool, NULL) → ap_strrchr_c(NULL, '/') → crash

    The crash has been verified by hand to ensure that the AI produced a
    correct analysis the associated tests pass as expected, both on Linux
    which was not affected, and on Windows.

    Co-Authored-By: BOB <BOB@ibm.com>
@PaulLodge PaulLodge changed the title Port dav Fix for crash on windows in quota.c Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant