From 0f19d223daa8ef950149950b3efc23ecc23baf7e Mon Sep 17 00:00:00 2001 From: mio Date: Thu, 22 Aug 2024 20:57:37 +1000 Subject: [PATCH] Use safer xine_get_current_frame_s xine_get_current_frame was deprecated back in 2019 because it is "unsafe by design"[0]. The '_s' version was introduced in xine-lib 1.1.11, which was released in 2008, so there are no version checks. [0]: https://sourceforge.net/p/xine/xine-lib-1.2/ci/c1a154c1a89759a8d69a6895587085adf6868d50 Signed-off-by: mio (cherry picked from commit f0b65f432b2e602bd9a515bcc460bcd6790a4925) --- kaffeine/src/player-parts/xine-part/kxinewidget.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kaffeine/src/player-parts/xine-part/kxinewidget.cpp b/kaffeine/src/player-parts/xine-part/kxinewidget.cpp index c6535e6..7361e19 100644 --- a/kaffeine/src/player-parts/xine-part/kxinewidget.cpp +++ b/kaffeine/src/player-parts/xine-part/kxinewidget.cpp @@ -3834,17 +3834,18 @@ void KXineWidget::getScreenshot(uchar*& rgb32BitData, int& videoWidth, int& vide int width, height, ratio, format; // double desired_ratio, image_ratio; - if (!xine_get_current_frame(m_xineStream, &width, &height, &ratio, &format, NULL)) + if (!xine_get_current_frame_s(m_xineStream, &width, &height, &ratio, &format, nullptr, nullptr)) return; - yuv = new uint8_t[((width+8) * (height+1) * 2)]; + int yuv_size = ((width + 8) * (height + 1)) * 2; + yuv = new uint8_t[yuv_size]; if (yuv == NULL) { errorOut("Not enough memory to make screenshot!"); return; } - xine_get_current_frame(m_xineStream, &width, &height, &ratio, &format, yuv); + xine_get_current_frame_s(m_xineStream, &width, &height, &ratio, &format, yuv, &yuv_size); videoWidth = width; videoHeight = height;