[Gptfdisk-general] Recent popt change seems to cause sgdisk segfault
Brought to you by:
srs5694
From: Adrian V. <adr...@gm...> - 2022-06-26 22:33:42
|
Hello, I'm running into a segmentation fault in `sgdisk --version`, that seems to originate from the strdup call introduced in commit 5d5e76d369a412bfb3d2cebb5fc0a7509cef878d. There's a backtrace in the downstream bug report[1], if you'd like to see it (though it's not very interesting, so I won't bother to copy it here) Here's my theory of what's going on: - sgdisk parses the `--version` option & prints its version. Then continues running - sgdisk calls `poptGetArg`. In this situation, `poptGetArg` probably returns NULL, since there's no arguments on the command line - Prior to 5d5e76d, this would have been OK (you check immediately afterward & exit cleanly if `poptGetArg` returns NULL). However, now, you end up calling `strdup(NULL)`, which leads to a segfault I haven't looked too closely at your codebase, and I'm not very familiar with popt's behavior, so I'm not certain that this is what's happening, but it seems to make sense as a theory. Let me know if there's anything I can do to assist you with fixing this bug Thank you, Adrian Vovk [1]: https://gitlab.com/carbonOS/build-meta/-/issues/104 |