[Aptitude-devel] Bug#1144159: aptitude: null pointer dereference in pkg_columnizer::setup_columns

Алексей Невров a.newrow at gmail.com
Tue Aug 11 20:02:54 BST 2026


Package: aptitude
Version: 0.8.13-7
Tags: patch

In src/pkg_columnizer.cc, function
pkg_item::pkg_columnizer::setup_columns(),
there is a guaranteed null pointer dereference when the default column
format string cannot be parsed.

The relevant code:

    columns = parse_columns(cfg, ...);
    ...
    if(!columns)
    {
        ...
        columns = parse_columns(cfg, ...);
        if(!columns)
        {
            _error->Warning(_("Internal error: Default column string is
unparsable"));
            const cw::config::column_definition col(...);
            columns->push_back(col);   // <-- dereference of nullptr
        }
    }

parse_columns() from cwidget returns NULL on parse failure. When the second
call also fails, columns is nullptr, but the code unconditionally
dereferences
it. This is undefined behavior (CWE-476).

Suggested fix:

    if(!columns)
    {
        _error->Warning(_("Internal error: Default column string is
unparsable"));
        columns = new cw::config::column_definition_list;
        const cw::config::column_definition col(...);
        columns->push_back(col);
    }

or return early to avoid the dereference.

This is an old upstream bug originally tracked at
https://bugs.debian.org/424659 and similar.

--
Alex Newrow
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/aptitude-devel/attachments/20260811/75812a0e/attachment.htm>


More information about the Aptitude-devel mailing list