From 14fd2d52823bbd08558f08466ebeaaa3550bb662 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Fri, 15 Nov 2019 09:39:45 -0500
Subject: [PATCH] video_scaler: remove assert and use a check instead

Change-Id: I47144b3f0eb00e84a058428c2fc2c2ea7a33d95f
---
 src/media/video/video_scaler.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/media/video/video_scaler.cpp b/src/media/video/video_scaler.cpp
index 0d45fd94bb..ae8ab014ca 100644
--- a/src/media/video/video_scaler.cpp
+++ b/src/media/video/video_scaler.cpp
@@ -107,8 +107,11 @@ VideoScaler::scale_and_pad(const VideoFrame& input, VideoFrame& output,
     }
 
     // buffer overflow checks
-    assert(xoff + dest_width <= (unsigned)output_frame->width);
-    assert(yoff + dest_height <= (unsigned)output_frame->height);
+    if ((xoff + dest_width > (unsigned)output_frame->width)
+        || (yoff + dest_height > (unsigned)output_frame->height)) {
+        JAMI_ERR("Unable to scale video");
+        return;
+    }
 
     ctx_ = sws_getCachedContext(ctx_,
                                 input_frame->width,
-- 
GitLab