likle / cwalk

Path library for C/C++. Cross-Platform for Linux, FreeBSD, Windows and MacOS. Supports UNIX and Windows path styles on those platforms.
https://likle.github.io/cwalk/
MIT License
250 stars 39 forks source link

Invalid pointer dereference with clang-analyzer #2

Closed fedegiova closed 5 years ago

fedegiova commented 5 years ago

Hi,

the function cwk_path_guess_style triggers a warning with clang static analyzer, I'm attaching the full report here

report.zip

basically the call to cwk_path_get_last_segment at line 1386 does not initialize segment.begin which is de-referenced the following line.

likle commented 5 years ago

@fedegiova Thank you for the bug report! Please let me know if you still have trouble with this issue after the previous commit.