Bug#295194: marked as done (libglib2.0-0: segfault in g_option_context_add_main_entries)

Torsten Marek Torsten Marek <shlomme@gmx.net>, 295194@bugs.debian.org
Mon, 14 Feb 2005 18:54:07 +0100


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sebastien Bacher schrieb:
| reopen 295194
| thanks
|
|
|>You program is not correct, you should not change the argc/argv values,
|>argc is the number of elements in argv. I'm closing this bug since
|>that's not a glib one.
|
|
| Misread it due to the 0 instead of NULL, reopening.
|
|

Ok, I now know what is going on.
First, the backtrace I submitted is wrong, the error happens in
free_pending_nulls in goption.c
On line 1034, the line
	*(n->ptr)[0] = '-';
tries to write into the string. However, n-ptr points to the read-only string
from context main, therefore a segfault happens. I think you were wrongly right
in closing the bug. Instead of assigning the string to myargv[1], a string has
to be malloc'd and copied.
Do you have a bugzilla account? I'm somehow reluctant to open one just for this one.
The link to the bug report is
https://bugzilla.mozilla.org/show_bug.cgi?id=273777

and a fix for this problem should be trivial.

greetings

Torsten
- --
Torsten Marek <shlomme@gmx.net>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146  894C 7CC5 451E A244 C858
Keyserver: subkeys.pgp.net

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCEOW/fMVFHqJEyFgRAmSRAKCw+GMxKAQvsR5jSeZs/ejQFO75ewCgmuSc
7mIQa8dBFRDpXypVGAzTjHg=
=MmMP
-----END PGP SIGNATURE-----