Closed kornelski closed 2 months ago
Cloning of an invalid URL causes segmentation fault:
let _ = git2::Repository::clone("https://dev.spacekookie.de/kookie/nomicon/src/development/tools/cargo-workspace2", "/tmp/testrepo");
(the destination directory must not exist)
libgit2-sys 0.16.2+1.7.2
thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) * frame #0: 0x000000018dce4660 libsystem_platform.dylib`_platform_strcmp + 144 frame #1: 0x00000001000c32a8 a`remove_service_suffix(url=0x000060000314c020, service_suffix="/info/refs?service=git-upload-pack") at net.c:902:26 frame #2: 0x00000001000c30c4 a`git_net_url_apply_redirect(url=0x000060000314c020, redirect_location="/kookie/nomicon/src/branch/main/development/tools/cargo-workspace2/info/refs", allow_offsite=true, service_suffix="/info/refs?service=git-upload-pack") at net.c:979:3 frame #3: 0x00000001000d4cf8 a`handle_response(complete=0x000000016fdfd8ef, stream=0x000060000044e160, response=0x000000016fdfd8f0, allow_replay=true) at http.c:253:7 frame #4: 0x00000001000d442c a`http_stream_read(s=0x000060000044e160, buffer="", buffer_size=65536, out_len=0x000000016fdfdaa8) at http.c:430:16 frame #5: 0x00000001000dc308 a`git_smart__recv(t=0x0000000110008000) at smart.c:29:8 frame #6: 0x00000001000e0554 a`git_smart__store_refs(t=0x0000000110008000, flushes=2) at smart_protocol.c:58:17 frame #7: 0x00000001000dcfdc a`git_smart__connect(transport=0x0000000110008000, url="https://dev.spacekookie.de/kookie/nomicon/src/development/tools/cargo-workspace2", direction=0, connect_opts=0x000000016fdfdc30) at smart.c:171:15 frame #8: 0x0000000100097990 a`git_remote_connect_ext(remote=0x000000011f704a80, direction=GIT_DIRECTION_FETCH, given_opts=0x000000016fdfde50) at remote.c:963:15 frame #9: 0x000000010002c27c a`clone_into(repo=0x0000000120804df0, _remote=0x0000000120804ff0, opts=0x000000016fdfe060, co_opts=0x000000016fdfdfd0, branch=0x0000000000000000) at clone.c:437:15 frame #10: 0x000000010002b868 a`git__clone(out=0x000000016fdfe678, url="https://dev.spacekookie.de/kookie/nomicon/src/development/tools/cargo-workspace2", local_path="/tmp/testrepo", _options=0x000000016fdfe2a0, use_existing=0) at clone.c:535:12 frame #11: 0x000000010002b524 a`git_clone(out=0x000000016fdfe678, url="https://dev.spacekookie.de/kookie/nomicon/src/development/tools/cargo-workspace2", local_path="/tmp/testrepo", _options=0x000000016fdfe2a0) at clone.c:566:9 frame #12: 0x00000001000130d0 a`git2::build::RepoBuilder::clone::haa717748c590843e(self=0x000000016fdfed08, url=(data_ptr = "https://dev.spacekookie.de/kookie/nomicon/src/development/tools/cargo-workspace2/tmp/testrepo", length = 80), into=&std::path::Path @ 0x000000016fdfe710) at build.rs:288:13 frame #13: 0x0000000100003418 a`git2::repo::Repository::clone::hc0f6651ccaf5fa79(url=(data_ptr = "https://dev.spacekookie.de/kookie/nomicon/src/development/tools/cargo-workspace2/tmp/testrepo", length = 80), into=(data_ptr = "/tmp/testrepo", length = 13)) at repo.rs:330:9
Thanks for the report! I believe this is fixed in 1.8 with is waiting on #1032.
Cloning of an invalid URL causes segmentation fault:
(the destination directory must not exist)
libgit2-sys 0.16.2+1.7.2
crash stack trace