!13 fix some bug: fix-undefined-behaviour adn support-conform-for-vector-of-unions
From: @YeFeng_24 Reviewed-by: @overweight Signed-off-by: @overweight
This commit is contained in:
commit
11d39ccf1f
27
0005-fix-undefined-behaviour.patch
Normal file
27
0005-fix-undefined-behaviour.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 57ee742cb1d2a2902dd5e00af5da9293aa11326c Mon Sep 17 00:00:00 2001
|
||||
From: yefeng <yefeng24@huawei.com>
|
||||
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<typename T>
|
||||
Offset<Vector<const T *>> CreateVectorOfStructs(const T *v, size_t len) {
|
||||
StartVector(len * sizeof(T) / AlignOf<T>(), AlignOf<T>());
|
||||
- PushBytes(reinterpret_cast<const uint8_t *>(v), sizeof(T) * len);
|
||||
+ if (len > 0) {
|
||||
+ PushBytes(reinterpret_cast<const uint8_t *>(v), sizeof(T) * len);
|
||||
+ }
|
||||
return Offset<Vector<const T *>>(EndVector(len));
|
||||
}
|
||||
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@ -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 <yefeng24@huawei.com> - 2.0.0-3
|
||||
* Wed Nov 17 2021 yefeng <yefeng24@huawei.com> - 2.0.0-4
|
||||
- fix undefined behaviour
|
||||
|
||||
* Mon Nov 15 2021 yefeng <yefeng24@huawei.com> - 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 <yefeng24@huawei.com> - 2.0.0-2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user