Hi,

If this patch is accepted: https://github.com/php/php-src/pull/1001
Should the few checks that are made before it is called be removed?

For example, in the /ext/phar/phar.c file:

1206                if (error) {
1207                        spprintf(error, 0, "internal error: attempt to 
flush cached zip-based phar \"%s\"", phar->fname);
1208                }

the a test is made correctly, to see whether error is NULL or not.

But in the same function, a test is not made.

1219                if (entry.fp == NULL) {
1220                        spprintf(error, 0, "phar error: unable to create 
temporary file");
1221                        return EOF;
1222                }

There are various other places that 'error'(pbuf) is not checked aganist
NULL, which could cause null pointer dereferences.

My question is, if the patch is accepted, should the "if (error) {"'s be
removed, or should they be added to the expressions that are missing them?
Does anybody know whether it would make the running time faster(by
nano-seconds) to add the checks against 'error' before the spprintf() is
used, or just to let spprintf() handle it. Does it matter?


Thanks,
-- 
-- Joshua Rogers <https://internot.info/>

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to