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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
             }
             switch (encoder->type) {
             case LZ_IMAGE_TYPE_PLT1_BE:
-- 
2.7.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]