File: 0018-magnify-check-the-image-conversion-worked.patch

package info (click to toggle)
vlc 3.0.21-10
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 212,728 kB
  • sloc: ansic: 441,379; cpp: 110,628; objc: 36,394; sh: 6,947; makefile: 6,592; javascript: 4,902; xml: 1,611; asm: 1,355; yacc: 640; python: 555; lex: 88; perl: 77; sed: 16
file content (44 lines) | stat: -rw-r--r-- 1,713 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 18 Jul 2024 09:23:58 +0200
Subject: magnify: check the image conversion worked

return NULL on failure as we cannot produce the required output.

Fixes #28707

(cherry picked from commit 990de75bc0a7db5f2c4e4cb88e868b75b689ac7d) (rebased)
rebased:
- picture_CopyPixels is called picture_CopyVisiblePixels on 4.0
Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
---
 modules/video_filter/magnify.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/modules/video_filter/magnify.c b/modules/video_filter/magnify.c
index 5f94f2d..375e6e7 100644
--- a/modules/video_filter/magnify.c
+++ b/modules/video_filter/magnify.c
@@ -244,6 +244,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         /* */
         fmt_out = p_filter->fmt_out.video;
         p_converted = image_Convert( p_sys->p_image, p_pic, &fmt_in, &fmt_out );
+        if (unlikely(!p_converted))
+        {
+            picture_Release( p_outpic );
+            return NULL;
+        }
         memcpy(p_pic->p, orig_planes, sizeof orig_planes);
 
         picture_CopyPixels( p_outpic, p_converted );
@@ -267,6 +272,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         fmt_out.i_height = fmt_out.i_visible_height = (fmt_out.i_visible_height/VIS_ZOOM) & ~1;
         p_converted = image_Convert( p_sys->p_image, p_pic,
                                      &p_pic->format, &fmt_out );
+        if (unlikely(!p_converted))
+        {
+            picture_Release( p_outpic );
+            return NULL;
+        }
 
         /* It will put only what can be copied at the top left */
         picture_CopyVisiblePixels( p_outpic, p_converted );