From bd4456b5f6eac8e1e670304abb644ee75815a9dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 26 May 2010 18:05:12 +0200 Subject: [PATCH] Fix bad SHM reads of ranges above 1MB. --- library/DFProcess-linux-SHM.cpp | 4 ++-- library/DFProcess-windows-SHM.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/DFProcess-linux-SHM.cpp b/library/DFProcess-linux-SHM.cpp index 4e0b50e1c..d4f90db93 100644 --- a/library/DFProcess-linux-SHM.cpp +++ b/library/DFProcess-linux-SHM.cpp @@ -609,7 +609,7 @@ void SHMProcess::read (uint32_t src_address, uint32_t size, uint8_t *target_buff else { // first read equals the size of the SHM window - uint32_t to_read = SHM_BODY - 1024; + uint32_t to_read = SHM_BODY; while (size) { // read to_read bytes from src_cursor @@ -617,7 +617,7 @@ void SHMProcess::read (uint32_t src_address, uint32_t size, uint8_t *target_buff D_SHMHDR->length = to_read; gcc_barrier d->SetAndWait(CORE_READ); - memcpy (target_buffer, D_SHMDATA(void) ,size); + memcpy (target_buffer, D_SHMDATA(void) ,to_read); // decrease size by bytes read size -= to_read; // move the cursors diff --git a/library/DFProcess-windows-SHM.cpp b/library/DFProcess-windows-SHM.cpp index 20b5dafd6..9a8bd8d4f 100644 --- a/library/DFProcess-windows-SHM.cpp +++ b/library/DFProcess-windows-SHM.cpp @@ -678,7 +678,7 @@ void SHMProcess::read (uint32_t src_address, uint32_t size, uint8_t *target_buff D_SHMHDR->length = to_read; full_barrier d->SetAndWait(CORE_READ); - memcpy (target_buffer, D_SHMDATA(void) ,size); + memcpy (target_buffer, D_SHMDATA(void) ,to_read); // decrease size by bytes read size -= to_read; // move the cursors