From e3a8bba3444b10c8110e9aa6f5d58fbbf56d9a64 Mon Sep 17 00:00:00 2001
From: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
Date: Mon, 23 Mar 2015 15:52:04 -0400
Subject: [PATCH] video: fix nullptr deferencing in video::noise()

Refs #67228

Change-Id: Idb39d86404cf9c420d6971005332d745e64b6114
---
 src/media/media_buffer.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/media/media_buffer.cpp b/src/media/media_buffer.cpp
index 3d1d2b1baa..4e1a2d43a7 100644
--- a/src/media/media_buffer.cpp
+++ b/src/media/media_buffer.cpp
@@ -132,9 +132,9 @@ void
 VideoFrame::noise()
 {
     auto f = frame_.get();
-    auto tot = size();
-    for (int i=0 ; i<tot ; ++i)
-    {
+    if (f->data[0] == nullptr)
+        return;
+    for (std::size_t i=0 ; i < size(); ++i) {
         f->data[0][i] = std::rand() & 255;
     }
 }
-- 
GitLab