Bug#583273: flegita: Crashes on startup

Matej Vela vela at debian.org
Thu May 17 09:54:44 UTC 2012


On Fri, May 28, 2010 at 10:42:44PM +0200, Julien BLACHE wrote:
> Андрей Парамонов <cmr.pent at gmail.com> wrote:
>
>> I've managed to get the following backtrace with hplip debug symbols:
>>
>> 0xb090304c in sane_hpaio_control_option (handle=0x8262800, option=10,
>> action=SANE_ACTION_GET_VALUE, pValue=0x0,
>>     pInfo=0xb34b21ac) at scan/sane/hpaio.c:2485
>> 2485                        *pIntValue = hpaio->currentDuplex;
>
> I think we have a winner :-) Now you'll just have to figure out why
> gnome-scan passes NULL here :/

Andrey, can you try rebuilding libsane-hpaio with the patch below?  Or I can
put together an (unofficial) package -- just let me know which dist/arch.

This is what seems to be happening:

(1) hplip-3.12.2/scan/sane/hpaio.c (sane_hpaio_open) initializes the option
    descriptor array with zeros.  Most descriptors are later given actual
    values (hpaioSetupOptions), but OPTION_DUPLEX (index 10) is initialized
    only if duplex is active; if not, its .size is left as 0.

(2) gnome-scan-0.6.2/modules/gsane-scanner.c (gss_option_get_value_by_index)
    fetches the duplex option descriptor, and passes its .size without
    checking to g_malloc0.  For a size of 0, g_malloc0 is defined to return
    NULL.  This is again passed without checking to sane_control_option,
    which segfaults as soon as it tries to store the return value there.

It's a given that gnome-scan would be better off with more sanity checks,
but I think the right thing to do is for libsane-hpaio to initialize the
OPTION_DUPLEX descriptor unconditionally, to ensure that the return value
from sane_get_option_descriptor is valid for all callers.

(I haven't worked with SANE before, and don't have a scanner to test with,
so take all this with a large grain of salt. :-)

Cheers,

Matej
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: hpaio-option-duplex.diff
URL: <http://lists.alioth.debian.org/pipermail/pkg-gnome-maintainers/attachments/20120517/a3e1887b/attachment.ksh>


More information about the pkg-gnome-maintainers mailing list