From 941613a06109eb002a487cd7d7e7dccb981b42d6 Mon Sep 17 00:00:00 2001 From: Rmys Date: Fri, 27 Sep 2024 14:44:31 +0300 Subject: [PATCH] gegl --- multimedia/graphics/gegl/files/66de8124.patch | 113 ++++++++++++++++++ .../gegl/files/Libraw_0_21_compatible.patch | 30 ----- .../gegl-0.2.0-cve-2012-4433-1e92e523.patch | 68 ----------- .../gegl-0.2.0-cve-2012-4433-4757cdf7.patch | 70 ----------- .../gegl/files/gegl-0.2.0-ffmpeg-0.11.patch | 11 -- multimedia/graphics/gegl/pspec.xml | 2 +- 6 files changed, 114 insertions(+), 180 deletions(-) create mode 100644 multimedia/graphics/gegl/files/66de8124.patch delete mode 100644 multimedia/graphics/gegl/files/Libraw_0_21_compatible.patch delete mode 100644 multimedia/graphics/gegl/files/gegl-0.2.0-cve-2012-4433-1e92e523.patch delete mode 100644 multimedia/graphics/gegl/files/gegl-0.2.0-cve-2012-4433-4757cdf7.patch delete mode 100644 multimedia/graphics/gegl/files/gegl-0.2.0-ffmpeg-0.11.patch diff --git a/multimedia/graphics/gegl/files/66de8124.patch b/multimedia/graphics/gegl/files/66de8124.patch new file mode 100644 index 0000000000..650e386c26 --- /dev/null +++ b/multimedia/graphics/gegl/files/66de8124.patch @@ -0,0 +1,113 @@ +From 66de8124f496617eee8e6b5c68138a00343882db Mon Sep 17 00:00:00 2001 +From: Joe Locash <@jlocash2> +Date: Sat, 4 May 2024 17:08:04 +0200 +Subject: [PATCH] ff-load, ff-save: fix build with FFmpeg 7 + +Fixing issue #371 +--- + operations/external/ff-load.c | 8 ++++++++ + operations/external/ff-save.c | 24 ++++++++++++++++++++++-- + 2 files changed, 30 insertions(+), 2 deletions(-) + +diff --git a/operations/external/ff-load.c b/operations/external/ff-load.c +index 6b96fdfdd..dc24a6d59 100644 +--- a/operations/external/ff-load.c ++++ b/operations/external/ff-load.c +@@ -250,7 +250,11 @@ decode_audio (GeglOperation *operation, + while (samples_left) + { + int sample_count = samples_left; ++#if LIBAVCODEC_VERSION_MAJOR < 61 + int channels = MIN(p->audio_stream->codecpar->channels, GEGL_MAX_AUDIO_CHANNELS); ++#else ++ int channels = MIN(p->audio_stream->codecpar->ch_layout.nb_channels, GEGL_MAX_AUDIO_CHANNELS); ++#endif + GeglAudioFragment *af = gegl_audio_fragment_new (o->audio_sample_rate, channels, + AV_CH_LAYOUT_STEREO, samples_left); + //); +@@ -553,7 +557,11 @@ prepare (GeglOperation *operation) + else + { + o->audio_sample_rate = p->audio_stream->codecpar->sample_rate; ++#if LIBAVCODEC_VERSION_MAJOR < 61 + o->audio_channels = MIN(p->audio_stream->codecpar->channels, GEGL_MAX_AUDIO_CHANNELS); ++#else ++ o->audio_channels = MIN(p->audio_stream->codecpar->ch_layout.nb_channels, GEGL_MAX_AUDIO_CHANNELS); ++#endif + } + } + +diff --git a/operations/external/ff-save.c b/operations/external/ff-save.c +index 9196b34aa..ffa5d8bee 100644 +--- a/operations/external/ff-save.c ++++ b/operations/external/ff-save.c +@@ -315,8 +315,13 @@ add_audio_stream (GeglProperties *o, AVFormatContext * oc, int codec_id) + } + cp->sample_rate = o->audio_sample_rate; + ++#if LIBAVCODEC_VERSION_MAJOR < 61 + cp->channel_layout = AV_CH_LAYOUT_STEREO; + cp->channels = 2; ++#else ++ cp->ch_layout.u.mask = AV_CH_LAYOUT_STEREO; ++ cp->ch_layout.nb_channels = 2; ++#endif + + return st; + } +@@ -392,8 +397,13 @@ static AVFrame *alloc_audio_frame(AVCodecContext *c, int nb_samples) + + frame->format = c->sample_fmt; + ++#if LIBAVCODEC_VERSION_MAJOR < 61 + frame->channel_layout = c->channel_layout; + frame->channels = c->channels; ++#else ++ frame->ch_layout = c->ch_layout; ++ frame->ch_layout.nb_channels = c->ch_layout.nb_channels; ++#endif + frame->sample_rate = c->sample_rate; + frame->nb_samples = nb_samples; + +@@ -423,8 +433,13 @@ static void encode_audio_fragments (Priv *p, AVFormatContext *oc, AVStream *st, + { + float left = 0, right = 0; + get_sample_data (p, i + p->audio_read_pos, &left, &right); ++#if LIBAVCODEC_VERSION_MAJOR < 61 + ((float*)frame->data[0])[c->channels*i+0] = left; + ((float*)frame->data[0])[c->channels*i+1] = right; ++#else ++ ((float*)frame->data[0])[c->ch_layout.nb_channels*i+0] = left; ++ ((float*)frame->data[0])[c->ch_layout.nb_channels*i+1] = right; ++#endif + } + break; + case AV_SAMPLE_FMT_FLTP: +@@ -441,8 +456,13 @@ static void encode_audio_fragments (Priv *p, AVFormatContext *oc, AVStream *st, + { + float left = 0, right = 0; + get_sample_data (p, i + p->audio_read_pos, &left, &right); ++#if LIBAVCODEC_VERSION_MAJOR < 61 + ((int16_t*)frame->data[0])[c->channels*i+0] = left * (1<<15); + ((int16_t*)frame->data[0])[c->channels*i+1] = right * (1<<15); ++#else ++ ((int16_t*)frame->data[0])[c->ch_layout.nb_channels*i+0] = left * (1<<15); ++ ((int16_t*)frame->data[0])[c->ch_layout.nb_channels*i+1] = right * (1<<15); ++#endif + } + break; + case AV_SAMPLE_FMT_S32: +@@ -450,8 +470,8 @@ static void encode_audio_fragments (Priv *p, AVFormatContext *oc, AVStream *st, + { + float left = 0, right = 0; + get_sample_data (p, i + p->audio_read_pos, &left, &right); +- ((int32_t*)frame->data[0])[c->channels*i+0] = left * (1<<31); +- ((int32_t*)frame->data[0])[c->channels*i+1] = right * (1<<31); ++ ((int32_t*)frame->data[0])[c->ch_layout.nb_channels*i+0] = left * (1<<31); ++ ((int32_t*)frame->data[0])[c->ch_layout.nb_channels*i+1] = right * (1<<31); + } + break; + case AV_SAMPLE_FMT_S32P: +-- +GitLab + diff --git a/multimedia/graphics/gegl/files/Libraw_0_21_compatible.patch b/multimedia/graphics/gegl/files/Libraw_0_21_compatible.patch deleted file mode 100644 index ebdb3b9208..0000000000 --- a/multimedia/graphics/gegl/files/Libraw_0_21_compatible.patch +++ /dev/null @@ -1,30 +0,0 @@ -From e2bc7a1fe46c0dcee708584555d445c9e066b6a1 Mon Sep 17 00:00:00 2001 -From: Chris Mayo -Date: Wed, 21 Dec 2022 19:32:02 +0000 -Subject: [PATCH] raw-load: make compatible with LibRaw 0.21.0 - -imgdata.params.shot_select moved to imgdata.rawparams.shot_select -https://github.com/LibRaw/LibRaw/blob/979160ff13/Changelog.txt#L182 ---- - operations/external/raw-load.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/operations/external/raw-load.c b/operations/external/raw-load.c -index 13eb661c2..7de2e232d 100644 ---- a/operations/external/raw-load.c -+++ b/operations/external/raw-load.c -@@ -114,7 +114,11 @@ prepare (GeglOperation *operation) - g_warning ("raw-load: Error Initializing raw library"); - else - { -+#if LIBRAW_COMPILE_CHECK_VERSION_NOTLESS(0, 21) -+ p->LibRaw->rawparams.shot_select = o->image_num; -+#else - p->LibRaw->params.shot_select = o->image_num; -+#endif - - p->LibRaw->params.aber[0] = 1.0; - p->LibRaw->params.aber[2] = 1.0; --- -GitLab - diff --git a/multimedia/graphics/gegl/files/gegl-0.2.0-cve-2012-4433-1e92e523.patch b/multimedia/graphics/gegl/files/gegl-0.2.0-cve-2012-4433-1e92e523.patch deleted file mode 100644 index 0babb0f41c..0000000000 --- a/multimedia/graphics/gegl/files/gegl-0.2.0-cve-2012-4433-1e92e523.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 1e92e5235ded0415d555aa86066b8e4041ee5a53 Mon Sep 17 00:00:00 2001 -From: Nils Philippsen -Date: Tue, 16 Oct 2012 14:58:27 +0000 -Subject: ppm-load: CVE-2012-4433: don't overflow memory allocation - -Carefully selected width/height values could cause the size of a later -allocation to overflow, resulting in a buffer much too small to store -the data which would then written beyond its end. ---- -diff --git a/operations/external/ppm-load.c b/operations/external/ppm-load.c -index efe6d56..3d6bce7 100644 ---- a/operations/external/ppm-load.c -+++ b/operations/external/ppm-load.c -@@ -84,7 +84,6 @@ ppm_load_read_header(FILE *fp, - /* Get Width and Height */ - img->width = strtol (header,&ptr,0); - img->height = atoi (ptr); -- img->numsamples = img->width * img->height * CHANNEL_COUNT; - - fgets (header,MAX_CHARS_IN_ROW,fp); - maxval = strtol (header,&ptr,0); -@@ -109,6 +108,16 @@ ppm_load_read_header(FILE *fp, - g_warning ("%s: Programmer stupidity error", G_STRLOC); - } - -+ /* Later on, img->numsamples is multiplied with img->bpc to allocate -+ * memory. Ensure it doesn't overflow. */ -+ if (!img->width || !img->height || -+ G_MAXSIZE / img->width / img->height / CHANNEL_COUNT < img->bpc) -+ { -+ g_warning ("Illegal width/height: %ld/%ld", img->width, img->height); -+ return FALSE; -+ } -+ img->numsamples = img->width * img->height * CHANNEL_COUNT; -+ - return TRUE; - } - -@@ -229,12 +238,24 @@ process (GeglOperation *operation, - if (!ppm_load_read_header (fp, &img)) - goto out; - -- rect.height = img.height; -- rect.width = img.width; -- - /* Allocating Array Size */ -+ -+ /* Should use g_try_malloc(), but this causes crashes elsewhere because the -+ * error signalled by returning FALSE isn't properly acted upon. Therefore -+ * g_malloc() is used here which aborts if the requested memory size can't be -+ * allocated causing a controlled crash. */ - img.data = (guchar*) g_malloc (img.numsamples * img.bpc); - -+ /* No-op without g_try_malloc(), see above. */ -+ if (! img.data) -+ { -+ g_warning ("Couldn't allocate %" G_GSIZE_FORMAT " bytes, giving up.", ((gsize)img.numsamples * img.bpc)); -+ goto out; -+ } -+ -+ rect.height = img.height; -+ rect.width = img.width; -+ - switch (img.bpc) - { - case 1: --- -cgit v0.9.0.2 diff --git a/multimedia/graphics/gegl/files/gegl-0.2.0-cve-2012-4433-4757cdf7.patch b/multimedia/graphics/gegl/files/gegl-0.2.0-cve-2012-4433-4757cdf7.patch deleted file mode 100644 index f78557f577..0000000000 --- a/multimedia/graphics/gegl/files/gegl-0.2.0-cve-2012-4433-4757cdf7.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 4757cdf73d3675478d645a3ec8250ba02168a230 Mon Sep 17 00:00:00 2001 -From: Nils Philippsen -Date: Tue, 16 Oct 2012 14:56:40 +0000 -Subject: ppm-load: CVE-2012-4433: add plausibility checks for header fields - -Refuse values that are non-decimal, negative or overflow the target -type. ---- -diff --git a/operations/external/ppm-load.c b/operations/external/ppm-load.c -index 3d6bce7..465096d 100644 ---- a/operations/external/ppm-load.c -+++ b/operations/external/ppm-load.c -@@ -36,6 +36,7 @@ gegl_chant_file_path (path, _("File"), "", _("Path of file to load.")) - #include "gegl-chant.h" - #include - #include -+#include - - typedef enum { - PIXMAP_ASCII = 51, -@@ -44,8 +45,8 @@ typedef enum { - - typedef struct { - map_type type; -- gint width; -- gint height; -+ glong width; -+ glong height; - gsize numsamples; /* width * height * channels */ - gsize bpc; /* bytes per channel */ - guchar *data; -@@ -82,11 +83,33 @@ ppm_load_read_header(FILE *fp, - } - - /* Get Width and Height */ -- img->width = strtol (header,&ptr,0); -- img->height = atoi (ptr); -+ errno = 0; -+ img->width = strtol (header,&ptr,10); -+ if (errno) -+ { -+ g_warning ("Error reading width: %s", strerror(errno)); -+ return FALSE; -+ } -+ else if (img->width < 0) -+ { -+ g_warning ("Error: width is negative"); -+ return FALSE; -+ } -+ -+ img->height = strtol (ptr,&ptr,10); -+ if (errno) -+ { -+ g_warning ("Error reading height: %s", strerror(errno)); -+ return FALSE; -+ } -+ else if (img->width < 0) -+ { -+ g_warning ("Error: height is negative"); -+ return FALSE; -+ } - - fgets (header,MAX_CHARS_IN_ROW,fp); -- maxval = strtol (header,&ptr,0); -+ maxval = strtol (header,&ptr,10); - - if ((maxval != 255) && (maxval != 65535)) - { --- -cgit v0.9.0.2 diff --git a/multimedia/graphics/gegl/files/gegl-0.2.0-ffmpeg-0.11.patch b/multimedia/graphics/gegl/files/gegl-0.2.0-ffmpeg-0.11.patch deleted file mode 100644 index d68444d5ff..0000000000 --- a/multimedia/graphics/gegl/files/gegl-0.2.0-ffmpeg-0.11.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- operations/external/ff-load.c.orig 2012-04-01 13:17:57.000000000 +0200 -+++ operations/external/ff-load.c 2012-07-11 12:42:05.174756560 +0200 -@@ -271,7 +271,7 @@ - gint err; - - ff_cleanup (o); -- err = av_open_input_file (&p->ic, o->path, NULL, 0, NULL); -+err = avformat_open_input (&p->ic, o->path, NULL, NULL); - if (err < 0) - { - print_error (o->path, err); diff --git a/multimedia/graphics/gegl/pspec.xml b/multimedia/graphics/gegl/pspec.xml index 953707bcbb..0cdca0a5c8 100644 --- a/multimedia/graphics/gegl/pspec.xml +++ b/multimedia/graphics/gegl/pspec.xml @@ -57,7 +57,7 @@ - + 66de8124.patch