#20 Segmentation fault in pkgconf_pkg_cflags()

Closed
opened 10 months ago by karen-arutyunov · 0 comments

The pkgconf_pkg_cflags() function called with PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS flag set for a package loaded from a pc-file which Requires.private field refers to non-existent module ends up with segmentation fault.

This happens because in the described situation it calls the pkgconf_fragment_free() function twice for the same list. Probably the following code in the pkgconf_pkg_cflags() function:

eflag = pkgconf_pkg_traverse(client, root, pkgconf_pkg_cflags_collect, list, maxdepth, skip_flags);
if (eflag != PKGCONF_PKG_ERRF_OK)
  pkgconf_fragment_free(list);

should be changed to:

eflag = pkgconf_pkg_traverse(client, root, pkgconf_pkg_cflags_collect, list, maxdepth, skip_flags);
if (eflag != PKGCONF_PKG_ERRF_OK)
{
  pkgconf_fragment_free(list);
  return eflag;
}
The pkgconf_pkg_cflags() function called with PKGCONF_PKG_PKGF_MERGE_PRIVATE_FRAGMENTS flag set for a package loaded from a pc-file which Requires.private field refers to non-existent module ends up with segmentation fault. This happens because in the described situation it calls the pkgconf_fragment_free() function twice for the same list. Probably the following code in the pkgconf_pkg_cflags() function: ``` eflag = pkgconf_pkg_traverse(client, root, pkgconf_pkg_cflags_collect, list, maxdepth, skip_flags); if (eflag != PKGCONF_PKG_ERRF_OK) pkgconf_fragment_free(list); ``` should be changed to: ``` eflag = pkgconf_pkg_traverse(client, root, pkgconf_pkg_cflags_collect, list, maxdepth, skip_flags); if (eflag != PKGCONF_PKG_ERRF_OK) { pkgconf_fragment_free(list); return eflag; } ```
Sign in to join this conversation.
No Label
No Milestone
No assignee
1 Participants
Loading...
Cancel
Save
There is no content yet.