From 5e965846d17f7053dca99f3366ce5d8f21e8f649 Mon Sep 17 00:00:00 2001 From: mio Date: Thu, 22 Aug 2024 16:33: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 --- src/app/captureFrame.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/captureFrame.cpp b/src/app/captureFrame.cpp index 4988999..41796b9 100644 --- a/src/app/captureFrame.cpp +++ b/src/app/captureFrame.cpp @@ -251,15 +251,16 @@ VideoWindow::captureFrame() const DEBUG_BLOCK int ratio, format, w, h; - if( !xine_get_current_frame( *engine(), &w, &h, &ratio, &format, NULL ) ) + if (!xine_get_current_frame_s(*engine(), &w, &h, &ratio, &format, nullptr, nullptr)) return TQImage(); - uint8_t *yuv = new uint8_t[((w+8) * (h+1) * 2)]; + int yuv_size = ((w + 8) * (h + 1)) * 2; + uint8_t *yuv = new uint8_t[yuv_size]; if( yuv == 0 ) { Debug::error() << "Not enough memory to make screenframe!\n"; return TQImage(); } - xine_get_current_frame( *engine(), &w, &h, &ratio, &format, yuv ); + xine_get_current_frame_s(*engine(), &w, &h, &ratio, &format, yuv, &yuv_size); // convert to yv12 if necessary uint8_t *y = 0, *u = 0, *v = 0;