bochs: backport overlapping memcpy fix
Upstream SVN r12563: "Bugfix: use memmove() if source and destination range can overlap (found with valgrind)." (Manually backported, the code structure has significantly changed before this fix.) Change-Id: Id176fb5b0aca806908cfb06f06bb5a7221ccc9c4
This commit is contained in:
@ -304,7 +304,7 @@ void bx_pci_ide_c::timer()
|
||||
// To avoid buffer overflow reset buffer pointers and copy data if necessary
|
||||
count = BX_PIDE_THIS s.bmdma[channel].buffer_top - BX_PIDE_THIS s.bmdma[channel].buffer_idx;
|
||||
if (count > 0) {
|
||||
memcpy(BX_PIDE_THIS s.bmdma[channel].buffer, BX_PIDE_THIS s.bmdma[channel].buffer_idx, count);
|
||||
memmove(BX_PIDE_THIS s.bmdma[channel].buffer, BX_PIDE_THIS s.bmdma[channel].buffer_idx, count);
|
||||
}
|
||||
BX_PIDE_THIS s.bmdma[channel].buffer_top = BX_PIDE_THIS s.bmdma[channel].buffer + count;
|
||||
BX_PIDE_THIS s.bmdma[channel].buffer_idx = BX_PIDE_THIS s.bmdma[channel].buffer;
|
||||
|
||||
Reference in New Issue
Block a user