diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-08-10 17:57:55 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-08-10 17:57:55 +0000 |
commit | a020cf7534ea51c56527777ba1524da82e89f406 (patch) | |
tree | b05e14b009a8ac2ac5e721ccc6c6822bf16512cc /gdk | |
parent | bbd6fdaa0470fdbe552be1d0ccc54210c314bed5 (diff) | |
parent | 59f6c50df8d4d9ceb90f109f6af5a96add3ec928 (diff) | |
download | gtk+-a020cf7534ea51c56527777ba1524da82e89f406.tar.gz |
Merge branch 'matthiasc/for-main' into 'main'
jpeg loader: Limit memory consumption
See merge request GNOME/gtk!4942
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/loaders/gdkjpeg.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gdk/loaders/gdkjpeg.c b/gdk/loaders/gdkjpeg.c index 8f7e422f0c..a2467cc286 100644 --- a/gdk/loaders/gdkjpeg.c +++ b/gdk/loaders/gdkjpeg.c @@ -161,6 +161,8 @@ gdk_load_jpeg (GBytes *input_bytes, jpeg_create_decompress (&info); + info.mem->max_memory_to_use = 100 * 1024 * 1024; + jpeg_mem_src (&info, g_bytes_get_data (input_bytes, NULL), g_bytes_get_size (input_bytes)); @@ -272,6 +274,7 @@ gdk_save_jpeg (GdkTexture *texture) info.err = jpeg_std_error (&err); jpeg_create_compress (&info); + info.image_width = width; info.image_height = height; info.input_components = 3; @@ -280,6 +283,8 @@ gdk_save_jpeg (GdkTexture *texture) jpeg_set_defaults (&info); jpeg_set_quality (&info, 75, TRUE); + info.mem->max_memory_to_use = 100 * 1024 * 1024; + jpeg_mem_dest (&info, &data, &size); memtex = gdk_memory_texture_from_texture (texture, |