From a3b8083f54beebd44e16facd61d1355cab5e6480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Tue, 26 Feb 2019 02:56:33 +0100 Subject: libcamera: camera: ensure streams belong to camera MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before calling into the pipeline handler make sure the streams provided by the application actually belongs to the camera. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/camera.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/libcamera/camera.cpp') diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index b4197f95..e3144c5b 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -366,6 +366,11 @@ Camera::streamConfiguration(std::set &streams) if (disconnected_ || !streams.size()) return std::map{}; + for (Stream *stream : streams) { + if (streams_.find(stream) == streams_.end()) + return std::map{}; + } + return pipe_->streamConfiguration(this, streams); } @@ -409,6 +414,11 @@ int Camera::configureStreams(std::map &config) return -EINVAL; } + for (auto const &iter : config) { + if (streams_.find(iter.first) == streams_.end()) + return -EINVAL; + } + ret = pipe_->configureStreams(this, config); if (ret) return ret; -- cgit v1.2.1