Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpm-4.20.0 possible segfault when erasing packaes. #3500

Open
mlschroe opened this issue Dec 20, 2024 · 0 comments
Open

rpm-4.20.0 possible segfault when erasing packaes. #3500

mlschroe opened this issue Dec 20, 2024 · 0 comments
Labels

Comments

@mlschroe
Copy link
Contributor

mlschroe commented Dec 20, 2024

rpmtriggers.c contains this:

    ix = rpmdbGetIteratorIndex(mfi->pi);
    if (ix < rpmdbGetIteratorCount(mfi->pi)) {
        offset = rpmdbGetIteratorOffsetFor(mfi->pi, ix);
        if (packageHashGetEntry(mfi->ts->members->removedPackages, offset,
                                &te, NULL, NULL)) {
            /* Files are available in memory */
            files  = rpmteFiles(te[0]);
        }

        if (packageHashGetEntry(mfi->ts->members->installedPackages, offset,
                                &te, NULL, NULL)) {
            /* Files are available in memory */
            files  = rpmteFiles(te[0]);
        }
    }

    if (files) {
        rpmdbSetIteratorIndex(mfi->pi, ix   1);
        mfi->pkgname = rpmteN(te[0]);
    } else {

The problem is that the second packageHashGetEntry call resets te to NULL, thus rpmteN(te[0]) will segfault if the te was found in the removedPackages hash. Current git has this fixed when C hashes were used.

I would do a similar fix, i.e. rename te to tes, add rpmte te = NULL;, add te = tes[0] before the assignment to files.

@pmatilai pmatilai added the bug label Dec 20, 2024
@pmatilai pmatilai added this to RPM Dec 20, 2024
@github-project-automation github-project-automation bot moved this to Backlog in RPM Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

2 participants