commit:     e2b0611a5d20eb60a5b5362975703b1909704289
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 27 21:18:46 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Dec 27 21:18:46 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=e2b0611a

libq/atom: fix crash in atom_compare on invalid input

Bug: https://bugs.gentoo.org/700850
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 libq/atom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libq/atom.c b/libq/atom.c
index efd32d1..6f65c8b 100644
--- a/libq/atom.c
+++ b/libq/atom.c
@@ -525,7 +525,7 @@ atom_compare(const depend_atom *data, const depend_atom 
*query)
        if (sfx_op == ATOM_OP_STAR) {
                if (query->letter)
                        ver_bits |= (1 << 0);
-               if (query->suffixes[0].suffix != VER_NORM)
+               if (query->suffixes && query->suffixes[0].suffix != VER_NORM)
                        ver_bits |= (1 << 1);
                /* This doesn't handle things like foo-1.0-r0*, but that atom
                 * doesn't ever show up in practice, so who cares. */

Reply via email to