aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakayuki Matsuoka <t-mat@users.noreply.github.com>2022-08-12 23:48:43 +0900
committerTakayuki Matsuoka <t-mat@users.noreply.github.com>2022-08-12 23:49:22 +0900
commit0fc36f1bc758e3d66cbbf863a5701d0ec006cd1a (patch)
treeb81b72c68fe88f384b5af5850914553a0d8701f8
parent5e22228e88340ec05cd9b3e275ef7a81af2709e8 (diff)
downloadlz4-0fc36f1bc758e3d66cbbf863a5701d0ec006cd1a.tar.gz
Suppress false positive warning from MSVC
MSVC (17.3 or earlier) reports the following warning lz4\lib\lz4.c(527): warning C6385: Reading invalid data from 'v'. Line 527 is : LZ4_memcpy(&v[4], v, 4); But, obviously v[0..3] is always filled with meaningful value. Therefore, this warning report is wrong. We must revisit this issue with future version of MSVC.
-rw-r--r--lib/lz4.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 2a31735a..654bfdf3 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -524,7 +524,14 @@ LZ4_memcpy_using_offset(BYTE* dstPtr, const BYTE* srcPtr, BYTE* dstEnd, const si
case 2:
LZ4_memcpy(v, srcPtr, 2);
LZ4_memcpy(&v[2], srcPtr, 2);
+#if defined(_MSC_VER) && (_MSC_VER <= 1933) /* MSVC 2022 ver 17.3 or earlier */
+# pragma warning(push)
+# pragma warning(disable : 6385) /* warning C6385: Reading invalid data from 'v'. */
+#endif
LZ4_memcpy(&v[4], v, 4);
+#if defined(_MSC_VER) && (_MSC_VER <= 1933) /* MSVC 2022 ver 17.3 or earlier */
+# pragma warning(pop)
+#endif
break;
case 4:
LZ4_memcpy(v, srcPtr, 4);