From 32635054bc76e2ababd8ea2177fca1f88229541a Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 2 Sep 2021 04:29:03 +0300 Subject: libcamera: framebuffer: Prevent modifying the number of metadata planes The number of metadata planes should always match the number of frame buffer planes. Enforce this by making the vector private and providing accessor functions. As this changes the public API, update all in-tree users accordingly. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jean-Michel Hautbois Reviewed-by: Hirokazu Honda --- src/cam/file_sink.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cam/file_sink.cpp') diff --git a/src/cam/file_sink.cpp b/src/cam/file_sink.cpp index 0b529e3e..0fc7d621 100644 --- a/src/cam/file_sink.cpp +++ b/src/cam/file_sink.cpp @@ -110,7 +110,7 @@ void FileSink::writeBuffer(const Stream *stream, FrameBuffer *buffer) for (unsigned int i = 0; i < buffer->planes().size(); ++i) { const FrameBuffer::Plane &plane = buffer->planes()[i]; - const FrameMetadata::Plane &meta = buffer->metadata().planes[i]; + const FrameMetadata::Plane &meta = buffer->metadata().planes()[i]; uint8_t *data = planeData_[&plane]; unsigned int length = std::min(meta.bytesused, plane.length); -- cgit v1.2.1