[Spice-commits] 2 commits - server/glz-encoder-dict.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 17 11:54:09 UTC 2020
server/glz-encoder-dict.c | 6 ++++++
1 file changed, 6 insertions(+)
New commits:
commit 21323c8b6f09d8f633910cc990e13e095c062d95
Author: Uri Lublin <uril at redhat.com>
Date: Sun May 17 18:08:44 2020 +0300
glz_dictionary_window_add_image: error out when failed to alloc an image
__glz_dictionary_window_alloc_image may return NULL.
Check that the image was created successfully and if not
then error out using dict->cur_usr->error like it's done
few lines below.
Signed-off-by: Uri Lublin <uril at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/glz-encoder-dict.c b/server/glz-encoder-dict.c
index 494d8878..72e3d1bb 100644
--- a/server/glz-encoder-dict.c
+++ b/server/glz-encoder-dict.c
@@ -495,6 +495,9 @@ static WindowImage *glz_dictionary_window_add_image(SharedDictionary *dict, LzIm
uint8_t* lines = first_lines;
// alloc image info,update used head tail, if used_head null - update head
WindowImage *image = __glz_dictionary_window_alloc_image(dict);
+ if (!image) {
+ dict->cur_usr->error(dict->cur_usr, "glz-dictionary failed to allocate an image\n");
+ }
image->id = dict->last_image_id++;
image->size = image_size;
image->type = image_type;
commit 031ab732dded42f10dc15fe7035b1f41158cf7ee
Author: Uri Lublin <uril at redhat.com>
Date: Sun May 17 17:55:02 2020 +0300
glz_enc_dictionary_restore: return NULL upon failure
glz_enc_dictionary_create may return NULL.
glz_enc_dictionary_restore itself may return NULL so
add one more check.
Found-by: gcc (10) analyzer
Signed-off-by: Uri Lublin <uril at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/glz-encoder-dict.c b/server/glz-encoder-dict.c
index 7bf16bfb..494d8878 100644
--- a/server/glz-encoder-dict.c
+++ b/server/glz-encoder-dict.c
@@ -197,6 +197,9 @@ GlzEncDictContext *glz_enc_dictionary_restore(GlzEncDictRestoreData *restore_dat
}
SharedDictionary *ret = (SharedDictionary *)glz_enc_dictionary_create(
restore_data->size, restore_data->max_encoders, usr);
+ if (!ret) {
+ return NULL;
+ }
ret->last_image_id = restore_data->last_image_id;
return ((GlzEncDictContext *)ret);
}
More information about the Spice-commits
mailing list