axel-download-accelerator / axel

Lightweight CLI download accelerator
GNU General Public License v2.0
3k stars 266 forks source link

Segfault in a particular 404 case #362

Closed aabacchus closed 3 years ago

aabacchus commented 3 years ago

Axel version 2.17.10

Running: axel https://github.com/axel-download-accelerator/axel/archive/refs/tags/BADNAME.tar.gz (works with any valid user/repo/archive/refs/tags/<anything that isn't there>.tar.gz) prints the following (for axel compiled with --enable-debug):

Initializing download: https://github.com/axel-download-accelerator/axel/archive/refs/tags/BADNAME.tar.gz
--- Sending request ---
GET /axel-download-accelerator/axel/archive/refs/tags/BADNAME.tar.gz HTTP/1.0
Host: github.com
Accept: */*
Accept-Encoding: identity
Range: bytes=0-
User-Agent: Axel/2.17.10 (linux-musl)
--- End of request ---
--- Reply headers ---
HTTP/1.1 302 Found
Server: GitHub.com
Date: Sun, 24 Oct 2021 21:31:01 GMT
Content-Type: text/html; charset=utf-8
Vary: X-PJAX, X-PJAX-Container, Accept-Encoding, Accept, X-Requested-With
permissions-policy: interest-cohort=()
Location: https://codeload.github.com/axel-download-accelerator/axel/tar.gz/refs/tags/BADNAME
Cache-Control: max-age=0, private
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Frame-Options: deny
X-Content-Type-Options: nosniff
X-XSS-Protection: 0
Referrer-Policy: no-referrer-when-downgrade
Expect-CT: max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"
Content-Security-Policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; child-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com objects-origin.githubusercontent.com www.githubstatus.com collector.githubapp.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com cdn.optimizely.com logx.optimizely.com/v1/events translator.github.com wss://alive.github.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com online.visualstudio.com/api/v1/locations raw.githubusercontent.com github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src render.githubusercontent.com viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: github.githubassets.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com secured-user-images.githubusercontent.com/ *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; worker-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/
Content-Length: 149
X-GitHub-Request-Id: DAE6:F893:291BECB:2BE55C3:6175D09B
connection: close
--- End of headers ---
--- Sending request ---
GET /axel-download-accelerator/axel/tar.gz/refs/tags/BADNAME HTTP/1.0
Host: codeload.github.com
Accept: */*
Accept-Encoding: identity
Range: bytes=0-
User-Agent: Axel/2.17.10 (linux-musl)
--- End of request ---
--- Reply headers ---
HTTP/1.0 404 Not Found
Access-Control-Allow-Origin: https://render.githubusercontent.com
Content-Security-Policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
Strict-Transport-Security: max-age=31536000
Vary: Authorization,Accept-Encoding,Origin
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-XSS-Protection: 1; mode=block
Date: Sun, 24 Oct 2021 21:31:07 GMT
Content-Length: 14
Content-Type: text/plain; charset=utf-8
X-GitHub-Request-Id: 805E:F742:8EA61:FC20B:6175D09B
--- End of headers ---
Segmentation fault (core dumped)

curl simply prints a 404 error message.

GDB reports the following backtrace:

#0  0x00007ffff7fae667 in memchr () from /lib/ld-musl-x86_64.so.1
#1  0x00007ffff7faf5c6 in strnlen () from /lib/ld-musl-x86_64.so.1
#2  0x0000555555558aa4 in ?? ()
#3  0x00007fffffffa230 in ?? ()
#4  0x00007ffff7fa8fdf in ?? () from /lib/ld-musl-x86_64.so.1
#5  0x0000000000000000 in ?? ()
ismaell commented 3 years ago

Does it happen with the code in master?

aabacchus commented 3 years ago

No :)