[Spice-devel] [spice-common 4/8] coverity: avoid dereference after null check

Christophe Fergeau cfergeau at redhat.com
Mon Apr 4 08:59:54 UTC 2016


On Mon, Apr 04, 2016 at 10:03:35AM +0200, Fabiano FidĂȘncio wrote:
> All decompress functions used after this check take into account that
> encoder->palette is not NULL. So, if we already detected that the
> palette is NULL, let's just return early.
> ---
>  common/lz.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/common/lz.c b/common/lz.c
> index d1c4033..2589223 100644
> --- a/common/lz.c
> +++ b/common/lz.c
> @@ -647,6 +647,7 @@ void lz_decode(LzContext *lz, LzImageType to_type, uint8_t *buf)
>              if (!encoder->palette) {
>                  encoder->usr->error(encoder->usr,
>                                      "a palette is missing (for bpp to rgb decoding)\n");
> +                return;

Why not, though the error callback ends with longjmp, so is not going to
return, so this should not be an issue with the current code.

Acked-by: Christophe Fergeau <cfergeau at redhat.com>

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160404/60dc0d58/attachment.sig>


More information about the Spice-devel mailing list