Bug#766357: [libnet-cups-perl] bad free() when finalizing the result of getDestinations()

Jean Privat privat.jean at uqam.ca
Wed Oct 22 20:17:04 UTC 2014


OK, I think I got it.

It seems related to printer instances (man lpoptions(1)).
I have two instances for the printer `xerox`: xerox/staple and xerox/single

After removing the instances, I cannot reproduce the bug.

In order to reproduce the bug, try to create a printer instance.

~~~
$ # Create an instance for the first printer
$ lpoptions -p `lpstat -p | head -1 | awk '1{print $2}'`/instance -o media=A4
$ # Show the bug
$ perl /usr/share/doc/libnet-cups-perl/examples/list_dests.pl
[...]
*** Error in `perl': free(): invalid pointer: 0x00000000021a4644 ***
Abandon
$ # Remove the created instance
$ lpoptions -x `lpstat -p | head -1 | awk '1{print $2}'`/instance
$ # No more bug!
$ perl /usr/share/doc/libnet-cups-perl/examples/list_dests.pl
[..] # fine
~~~

On Wed, Oct 22, 2014 at 3:54 PM, Jean Privat <privat.jean at uqam.ca> wrote:
> Here a run of the small script with gdb.
>
> $ gdb --args perl c.pl
> GNU gdb (Debian 7.7.1+dfsg-3) 7.7.1
> Copyright (C) 2014 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-linux-gnu".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
> <http://www.gnu.org/software/gdb/documentation/>.
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from perl...(no debugging symbols found)...done.
> (gdb) run
> Starting program: /usr/bin/perl c.pl
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> X
> *** Error in `/usr/bin/perl': free(): invalid pointer: 0x00000000008a47d4 ***
>
> Program received signal SIGABRT, Aborted.
> 0x00007ffff6f89077 in __GI_raise (sig=sig at entry=6) at
> ../nptl/sysdeps/unix/sysv/linux/raise.c:56
> 56 ../nptl/sysdeps/unix/sysv/linux/raise.c: Aucun fichier ou dossier de ce type.
> (gdb) thread apply all bt
>
> Thread 1 (Thread 0x7ffff7fc4700 (LWP 29258)):
> #0  0x00007ffff6f89077 in __GI_raise (sig=sig at entry=6) at
> ../nptl/sysdeps/unix/sysv/linux/raise.c:56
> #1  0x00007ffff6f8a458 in __GI_abort () at abort.c:89
> #2  0x00007ffff6fc6fb4 in __libc_message (do_abort=do_abort at entry=1,
> fmt=fmt at entry=0x7ffff70b9bc0 "*** Error in `%s': %s: 0x%s ***\n")
>     at ../sysdeps/posix/libc_fatal.c:175
> #3  0x00007ffff6fcc78e in malloc_printerr (action=1,
> str=0x7ffff70b5c7e "free(): invalid pointer", ptr=<optimized out>) at
> malloc.c:4996
> #4  0x00007ffff6fcd496 in _int_free (av=<optimized out>, p=<optimized
> out>, have_lock=0) at malloc.c:3840
> #5  0x00007ffff6b0d2b1 in ?? () from
> /usr/lib/x86_64-linux-gnu/perl5/5.20/auto/Net/CUPS/CUPS.so
> #6  0x00007ffff7aea5ab in Perl_pp_entersub () from
> /usr/lib/x86_64-linux-gnu/libperl.so.5.20
> #7  0x00007ffff7ae2e46 in Perl_runops_standard () from
> /usr/lib/x86_64-linux-gnu/libperl.so.5.20
> #8  0x00007ffff7a6c3e5 in Perl_call_sv () from
> /usr/lib/x86_64-linux-gnu/libperl.so.5.20
> #9  0x00007ffff7af421f in ?? () from /usr/lib/x86_64-linux-gnu/libperl.so.5.20
> #10 0x00007ffff7af4c40 in Perl_sv_clear () from
> /usr/lib/x86_64-linux-gnu/libperl.so.5.20
> #11 0x00007ffff7af4ffa in Perl_sv_free2 () from
> /usr/lib/x86_64-linux-gnu/libperl.so.5.20
> #12 0x00007ffff7b17ee0 in Perl_free_tmps () from
> /usr/lib/x86_64-linux-gnu/libperl.so.5.20
> #13 0x00007ffff7ae35f5 in Perl_pp_nextstate () from
> /usr/lib/x86_64-linux-gnu/libperl.so.5.20
> #14 0x00007ffff7ae2e46 in Perl_runops_standard () from
> /usr/lib/x86_64-linux-gnu/libperl.so.5.20
> #15 0x00007ffff7a73e0e in perl_run () from
> /usr/lib/x86_64-linux-gnu/libperl.so.5.20
> #16 0x0000000000400e19 in main ()
>
> On Wed, Oct 22, 2014 at 1:04 PM, gregor herrmann <gregoa at debian.org> wrote:
>> Control: tag -1 + unreproducible
>>
>> On Wed, 22 Oct 2014 09:44:34 -0400, Jean Privat wrote:
>>
>> Thanks for your bug report!
>>
>> Unfortunately, all these three tests ...
>>
>>> $ perl /usr/share/doc/libnet-cups-perl/examples/list_dests.pl
>> [..]
>>
>>> ~~~perl
>>> use Net::CUPS;
>>> {
>>> $sc = Net::CUPS->new();
>>> my @pl = $sc->getDestinations();
>>> print("A\n");
>>> }
>>> print("B\n");
>>> ~~~
>>>
>>> When executed, it prints only A
>>>
>>> ~~~
>>> A
>>> *** Error in `perl': free(): invalid pointer: 0x0000000001fba634 ***
>>> Abandon
>>> ~~~
>>>
>>> Removing the `my` in `my @pl` force delay the error at the end of the
>>> program. thus A and B are printed
>>>
>>> ~~~
>>> $ perl c.pl
>>> A
>>> B
>>> *** Error in `perl': free(): invalid pointer: 0x0000000002459384 ***
>>> Abandon
>>> ~~~
>>
>>
>> ... work without any problems for me.
>>
>>
>> The only thing I notice is ...
>>
>>> --- System information. ---
>>> Architecture: amd64
>>> Kernel:       Linux 3.16-3-amd64
>>>
>>> Debian Release: jessie/sid
>>>   990 testing         security.debian.org
>>>   990 testing         http.debian.net
>>>   500 unstable        http.debian.net
>>>   500 stable          security.debian.org
>>>   500 stable          http.debian.net
>>>   500 stable          dl.google.com
>>>     1 experimental    http.debian.net
>>>
>>> --- Package information. ---
>>> Depends                (Version) | Installed
>>> ================================- -==============
>>> perl               (>= 5.20.0-4) | 5.20.1-1
>>> perlapi-5.20.0                   |
>>> libc6                   (>= 2.4) |
>>> libcups2              (>= 1.6.0) |
>>
>> ... that you are on testing and I'm on unstable but I have no idea if
>> this make a difference.
>>
>>
>> Anyone else with test results or ideas?
>> Maybe running /usr/share/doc/libnet-cups-perl/examples/list_dests.pl
>> under gdb sheds a light where this is happening?
>>
>>
>> Cheers,
>> gregor
>>
>> --
>>  .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
>>  : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
>>  `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
>>    `-   NP: Element Of Crime: Alle vier Minuten
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1
>>
>> iQJ8BAEBCgBmBQJUR+OmXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
>> ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXREMUUxMzE2RTkzQTc2MEE4MTA0RDg1RkFC
>> QjNBNjgwMTg2NDlBQTA2AAoJELs6aAGGSaoGwhAP/RXnhJv9uvvu8uoPFjrDyzmF
>> Kx7qEKArnJNRsyTLKC7S+UJxKuaxLj/RehclosmkzE1A4t5GfyeJMb7F/VeiBKCn
>> me65tI2EZuJWAX/Y8SQvSAyGkJDpNS5fsJMKmL3tDKAH6NRFTIoX9Vv+Dbwi4vg2
>> /ghApfaUkREvH/ECYVnpKqnpIjL4BuMQFMDSk9mIM5UsVtB2lyYMjhPBImzyRiR0
>> hBQxxsgmP8zCT8DIqxTsOibYw04wB4mFcWJCu9U1xTm3Vh3oByDpgAAti2553UPy
>> AsuUYmJFxjA1eZ4SbKyVt1149Q1VNjF90btE//G0T3NXfqth2H2dskh8GE5q4zsy
>> 4WKK3S+7DIMJ1R32FR1BxlLzzvx61SD0V/71bbIhYECAvkjcaZfc9njHUesygxYi
>> WfFqsBzH42kj4tOE28J94t+ZEBoB5wnxQ3QxrPmq1sW8kOpijTKO5feeYazlCF6P
>> Zrh7dj/iBSSEvh2yKjXETfeD3S5r0mEvxZSjXeeaG8kX/suPrE5/mjmRmVDAvEmM
>> OWtoT56eQ0qnFkTGyR2ZEsD/4RQ3DU/W2Kr59rZH/hQB3GRUrsd+LwpMvPmyArGQ
>> jv9Dy6Fg+KCh0FD8ZdLzFV/6w9c9164AcibvR3KK21U+IV0hVSRZBFXaLdRrbdZt
>> y3SXI18dnw+rAL5VbxHC
>> =Gjs9
>> -----END PGP SIGNATURE-----
>>
>
>
>
> --
> Jean PRIVAT, professeur/professor
> Département d'informatique/Department of Computer Science
> U.Q.A.M.
> CP 8888, succ. centre-ville
> Montréal (Québec)
> Canada H3C 3P8
>
> Bureau/Office: PK-4830
> Site/Web: http://info.uqam.ca/~privat/



-- 
Jean PRIVAT, professeur/professor
Département d'informatique/Department of Computer Science
U.Q.A.M.
CP 8888, succ. centre-ville
Montréal (Québec)
Canada H3C 3P8

Bureau/Office: PK-4830
Site/Web: http://info.uqam.ca/~privat/



More information about the pkg-perl-maintainers mailing list