Re: mime_magic segfaults
| From: | Ilia A. | Date: | Fri, 15 Nov 2002 14:14:53 +0000 |
| Subject: | Re: mime_magic segfaults | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-91093@lists.php.net to get a copy of this message | ||
Why was rb changed to rt?
Ilia
On November 15, 2002 06:58 am, Moriyoshi Koizumi wrote:
> Thanks, it works.
> Attacthed is a slightly modified version of Ilia's patch in consideration
> of win32 build.
> If there are no objections, I'll commit it.
>
>
> Moriyoshi
>
> "Ilia A." <ilia@prohost.org> wrote:
> > Could you try the attached patch and see if it fixes the problem.
> >
> > Ilia
> >
> > On November 14, 2002 03:10 pm, Moriyoshi Koizumi wrote:
> > > Hi,
> > >
> > > I found a bug in mime_magic. If the module fails to read the magic file
> > > specified by mime_magic.magicfile during the module initialisation, it
> > > tries to put an error, and then segfaults.
> > >
> > > Here's the backtrace.
> > >
> > > #0 0x0813402b in sapi_send_headers (tsrm_ls=0x8277f68)
> > > at /home/koizumi/src/php.net/HEAD/php4/main/SAPI.c:673
> > > #1 0x080e5ce2 in php_header ()
> > > at /home/koizumi/src/php.net/HEAD/php4/ext/standard/head.c:62
> > > #2 0x08171433 in sapi_cli_log_message (
> > > message=0x82a5c74 "PHP Warning: mime_magic: can't read magic file
> > > .ext/mime _magic/tests/magic.test.1 in Unknown on line 0")
> > > at /home/koizumi/src/php.net/HEAD/php4/sapi/cli/php_cli.c:174
> > > #3 0x0812d639 in php_log_err (
> > > log_message=0x82a5c74 "PHP Warning: mime_magic: can't read magic
> > > file .ext/ mime_magic/tests/magic.test.1 in Unknown on line 0",
> > > tsrm_ls=0x8277f68) at
> > > /home/koizumi/src/php.net/HEAD/php4/main/main.c:360 #4 0x0812dc9a in
> > > php_error_cb (type=2, error_filename=0x8228eab "Unknown",
> > > error_lineno=0, format=0x81fcb00 "mime_magic: can't read magic file
> > > %s", args=0xbfffd7b8) at
> > > /home/koizumi/src/php.net/HEAD/php4/main/main.c:600 #5 0x081581d9 in
> > > zend_error (type=2,
> > > format=0x81fcb00 "mime_magic: can't read magic file %s")
> > > at /home/koizumi/src/php.net/HEAD/php4/Zend/zend.c:711
> > > #6 0x080b2206 in apprentice ()
> > > at
> > > /home/koizumi/src/php.net/HEAD/php4/ext/mime_magic/mime_magic.c:348 #7
> > > 0x080b1f4e in zm_startup_mime_magic (type=1, module_number=9,
> > > tsrm_ls=0x8277f68)
> > > at
> > > /home/koizumi/src/php.net/HEAD/php4/ext/mime_magic/mime_magic.c:266 #8
> > > 0x0815a053 in zend_startup_module (module=0x82577a0)
> > > at /home/koizumi/src/php.net/HEAD/php4/Zend/zend_API.c:1008
> > > #9 0x0812ec2b in php_startup_extensions (ptr=0x82621a0, count=15)
> > > at /home/koizumi/src/php.net/HEAD/php4/main/main.c:974
> > > #10 0x08172732 in php_startup_internal_extensions ()
> > > at main/internal_functions_cli.c:79
> > > #11 0x0812f090 in php_module_startup (sf=0x8261f60,
> > > additional_modules=0x0, num_additional_modules=0)
> > > at /home/koizumi/src/php.net/HEAD/php4/main/main.c:1138
> > > #12 0x08171955 in main (argc=1, argv=0xbffffa94)
> > > at /home/koizumi/src/php.net/HEAD/php4/sapi/cli/php_cli.c:446
> > > #13 0x40318507 in __libc_start_main (main=0x81717e8 <main>, argc=1,
> > > ubp_av=0xbffffa94, init=0x80671f8 <_init>, fini=0x8172770 <_fini>,
> > > rtld_fini=0x4000dc14 <_dl_fini>, stack_end=0xbffffa8c)
> > > at ../sysdeps/generic/libc-start.c:129
> > >
> > >
> > > IMO php_error() should not be used in PHP_MINIT_FUNCTION. Any fix else?
> > >
> > >
> > > Moriyoshi