diff mbox series

[FFmpeg-devel,10/24] sws: group the parameters validity checks together

Message ID 20210531075515.19544-10-anton@khirnov.net
State Accepted
Commit 2730639259f5bdf81d4223cd8f4275e2939a1482
Headers show
Series [FFmpeg-devel,01/24] sws: remove unnecessary braces | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Anton Khirnov May 31, 2021, 7:55 a.m. UTC
Also, fail with an error code rather than 0.
---
 libswscale/swscale.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Michael Niedermayer June 1, 2021, 12:02 p.m. UTC | #1
On Mon, May 31, 2021 at 09:55:01AM +0200, Anton Khirnov wrote:
> Also, fail with an error code rather than 0.
> ---
>  libswscale/swscale.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)

LGTM

thx

[...]
diff mbox series

Patch

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 1cf89e4684..37c7cf60dd 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -890,6 +890,15 @@  int attribute_align_arg sws_scale(struct SwsContext *c,
         return AVERROR(EINVAL);
     }
 
+    if (!check_image_pointers(srcSlice, c->srcFormat, srcStride)) {
+        av_log(c, AV_LOG_ERROR, "bad src image pointers\n");
+        return AVERROR(EINVAL);
+    }
+    if (!check_image_pointers((const uint8_t* const*)dst, c->dstFormat, dstStride)) {
+        av_log(c, AV_LOG_ERROR, "bad dst image pointers\n");
+        return AVERROR(EINVAL);
+    }
+
     if (c->gamma_flag && c->cascaded_context[0])
         return scale_gamma(c, srcSlice, srcStride, srcSliceY, srcSliceH, dst, dstStride);
 
@@ -905,15 +914,6 @@  int attribute_align_arg sws_scale(struct SwsContext *c,
     if (srcSliceH == 0)
         return 0;
 
-    if (!check_image_pointers(srcSlice, c->srcFormat, srcStride)) {
-        av_log(c, AV_LOG_ERROR, "bad src image pointers\n");
-        return 0;
-    }
-    if (!check_image_pointers((const uint8_t* const*)dst, c->dstFormat, dstStride)) {
-        av_log(c, AV_LOG_ERROR, "bad dst image pointers\n");
-        return 0;
-    }
-
     if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
         av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");
         return 0;