Skip to content

tool_doswin: add debug envs to test filename sanitization failure modes - #20125

Closed
vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:sanitdeb
Closed

vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:sanitdeb

Conversation

@vszakats

@vszakats vszakats commented Dec 31, 2025 •

Copy link
Copy Markdown
Member
  • CURL_FN_SANITIZE_BAD=<any-value> to simulate
    SANITIZE_ERR_INVALID_PATH.

  • CURL_FN_SANITIZE_OOM=<any-value> to simulate
    SANITIZE_ERR_OUT_OF_MEMORY.

Both are Windows/MS-DOS-specific and require debug-enabled curl build.

Cherry-picked from #20116

@github-actions github-actions Bot added cmdline tool Windows Windows-specific labels Dec 31, 2025
@vszakats vszakats added tests Windows Windows-specific and removed Windows Windows-specific labels Dec 31, 2025
@vszakats vszakats closed this in 8c02407 Dec 31, 2025
@vszakats
vszakats deleted the sanitdeb branch December 31, 2025 11:16
vszakats added a commit that referenced this pull request Jan 10, 2026
…n fails

On MS-DOS (OOM and bad filename) and Windows (OOM only).

Given the rarity of both platform and error, we make a compromise and
return an unrelated libcurl error (43) in case of a bad output filename
on MS-DOS.

After:
```
$ CURL_FN_SANITIZE_OOM=1 wine curl.exe https://curl.se/ --output out.txt
curl: (27) Out of memory

$ CURL_FN_SANITIZE_BAD=1 wine curl.exe https://curl.se/ --output out.txt
Warning: bad output filename
curl: (43) A libcurl function was given a bad argument

$ CURL_FN_SANITIZE_OOM=1 wine curl.exe https://curl.se/index.html --globoff -O
curl: (27) Out of memory

$ CURL_FN_SANITIZE_BAD=1 wine curl.exe https://curl.se/index.html --globoff -O
curl: bad output filename
curl: (43) A libcurl function was given a bad argument
```

Before:
```
$ CURL_FN_SANITIZE_OOM=1 wine curl.exe https://curl.se/ --output out.txt
Warning: bad output glob
curl: (27) Out of memory

$ CURL_FN_SANITIZE_BAD=1 wine curl.exe https://curl.se/ --output out.txt
Warning: bad output glob
curl: (3) URL using bad/illegal format or missing URL

$ CURL_FN_SANITIZE_OOM=1 wine curl.exe https://curl.se/index.html --globoff -O
curl: Failed to extract a filename from the URL to use for storage
curl: (27) Out of memory

$ CURL_FN_SANITIZE_BAD=1 wine curl.exe https://curl.se/index.html --globoff -O
curl: Failed to extract a filename from the URL to use for storage
curl: (3) URL using bad/illegal format or missing URL
```

Ref: #20116 (simpler reboot of)
Ref: #20113 #20121
Ref: 40c1748 #20198
Ref: eb7f5b7 #20143
Ref: 8c02407 #20125
Fixes #20044
Closes #20199
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant