diff --git a/0005-fix-undefined-behaviour.patch b/0005-fix-undefined-behaviour.patch new file mode 100644 index 0000000000000000000000000000000000000000..c719d5c61d2a2f5a9f1af40737c185f5f8398e82 --- /dev/null +++ b/0005-fix-undefined-behaviour.patch @@ -0,0 +1,27 @@ +From 57ee742cb1d2a2902dd5e00af5da9293aa11326c Mon Sep 17 00:00:00 2001 +From: yefeng +Date: Wed, 17 Nov 2021 14:49:42 +0800 +Subject: [PATCH 1/2] fix undefined behaviour + +--- + include/flatbuffers/flatbuffers.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h +index e652e40..42c4fa8 100644 +--- a/include/flatbuffers/flatbuffers.h ++++ b/include/flatbuffers/flatbuffers.h +@@ -1808,7 +1808,9 @@ class FlatBufferBuilder { + template + Offset> CreateVectorOfStructs(const T *v, size_t len) { + StartVector(len * sizeof(T) / AlignOf(), AlignOf()); +- PushBytes(reinterpret_cast(v), sizeof(T) * len); ++ if (len > 0) { ++ PushBytes(reinterpret_cast(v), sizeof(T) * len); ++ } + return Offset>(EndVector(len)); + } + +-- +2.17.1 + diff --git a/flatbuffers.spec b/flatbuffers.spec index c544eb7c059abf78a0133007efadac80469dbbc4..64dd38c1718d4d639303d34ba1d5032043bfef7a 100644 --- a/flatbuffers.spec +++ b/flatbuffers.spec @@ -5,7 +5,7 @@ %endif Name: flatbuffers Version: 2.0.0 -Release: 3 +Release: 4 Summary: Memory efficient serialization library License: Apache-2.0 URL: https://github.com/google/flatbuffers @@ -17,6 +17,7 @@ Patch0: 0001-Fix-compiler-warning-Wredundant-parens.patch Patch1: 0002-typo-fixes-in-comments.patch Patch2: 0003-Changes-to-support-binary-schema-file-loading-and-pa.patch Patch3: 0004-output-errors-instead-of-stdout.patch +Patch4: 0005-fix-undefined-behaviour.patch BuildRequires: gcc-c++ cmake >= 2.8.9 Provides: bundled(grpc) @@ -75,7 +76,10 @@ make test %{_libdir}/cmake/flatbuffers/*.cmake %changelog -* Wed Nov 15 2021 yefeng - 2.0.0-3 +* Wed Nov 17 2021 yefeng - 2.0.0-4 +- fix undefined behaviour + +* Mon Nov 15 2021 yefeng - 2.0.0-3 - output errors instead of stdout, Typo fixes in comments and Changes to support binary schema file * Wed Nov 11 2021 yefeng - 2.0.0-2