From 4aa701f47f2123365db3d5e9791aa82b5db4d106 Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Mon, 13 Dec 2021 11:57:07 +0000 Subject: [PATCH 1/2] PoC image file for https://github.com/Exiv2/exiv2/issues/2027 --- test/data/issue_2027_poc.jpg | Bin 0 -> 1548 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/data/issue_2027_poc.jpg diff --git a/test/data/issue_2027_poc.jpg b/test/data/issue_2027_poc.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8137b30d8b5ea2e2315fb5e7e6b15ab36c430c07 GIT binary patch literal 1548 zcmex=TH&{Ud zs4TzW|9^%ChWD8aj~LiM>hmUNX*nhFR&YKh1DGh@!(*6O z_W;u()IFXqj5ytcX&EUZQmBgMP`M=WHseu!7ZkJu2Joh}%lOk8<4TfpFF0-qZ4U!gIWdvot(wL literal 0 HcmV?d00001 From e34eacc46752a29df71a554ee8d847a3bdc13a4d Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Mon, 13 Dec 2021 12:22:54 +0000 Subject: [PATCH 2/2] Use memmove, rather than memcpy, because memory regions might overlap. --- src/tiffvisitor_int.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tiffvisitor_int.cpp b/src/tiffvisitor_int.cpp index 04b16f6ef0..1540cda310 100644 --- a/src/tiffvisitor_int.cpp +++ b/src/tiffvisitor_int.cpp @@ -745,7 +745,7 @@ namespace Exiv2 { #endif memset(buf + 8, 0x0, 4); if (pTiffEntry->size() > 0) { - memcpy(buf + 8, pTiffEntry->pData(), pTiffEntry->size()); + memmove(buf + 8, pTiffEntry->pData(), pTiffEntry->size()); memset(const_cast(pTiffEntry->pData()), 0x0, pTiffEntry->size()); } }