commit 9d527385c68ed73f0b2635671d9fca736a87b97e
Author: Kornel Benko <[email protected]>
Date: Fri Jun 27 13:41:45 2025 +0200
Memory overlap
Fix overlap spotted with '-fsanitize=address'
---
src/support/gzstream.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/support/gzstream.cpp b/src/support/gzstream.cpp
index 232e86bb3d..f6083211f7 100644
--- a/src/support/gzstream.cpp
+++ b/src/support/gzstream.cpp
@@ -92,7 +92,9 @@ int gzstreambuf::underflow() { // used for input buffer only
int n_putback = gptr() - eback();
if ( n_putback > 4)
n_putback = 4;
- memcpy( buffer + (4 - n_putback), gptr() - n_putback, n_putback);
+ char tmp[5];
+ memcpy(tmp, gptr() - n_putback, n_putback);
+ memcpy( buffer + (4 - n_putback), tmp, n_putback);
int num = gzread( file, buffer+4, bufferSize-4);
if (num <= 0) // ERROR or EOF
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs