Subject: | A NULL pointer derefernce in bzfile_clearerr() |
bzfile_clearerr() function is written like this:
int bzfile_clearerr( bzFile *obj ) {
int error_num = obj == NULL ? global_bzip_errno : obj->bzip_errno;
...
else if ( error_num == BZ_OK ) {
if ( obj->pending_io_error ) {
...
If obj is NULL and global_bzip_errno is BZ_OK then the "obj->pending_io_error" expression experiences a NULL pointer dereference.
I know that bzfile_clearerr() is called only from Compress::Bzip2::bzclearerr() method, so the object reference should not NULL, but still bzfile_clearerr() starts with a code that clearly compares the reference against NULL. So there is a little discrepancy.
Also one should consider that bzfile_clearerr() is not declared as a static function, and thus any C (XS) code can call it.