File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -51,9 +51,13 @@ class Buffer {
51
51
52
52
void CopyDataFrom (const Buffer& other);
53
53
54
- Buffer (Buffer&& other) { raw_ = other.Release (); }
54
+ Buffer (Buffer&& other) {
55
+ raw_ = other.Release ();
56
+ size_ = other.size ();
57
+ }
55
58
Buffer& operator =(Buffer&& other) {
56
59
raw_ = other.Release ();
60
+ size_ = other.size ();
57
61
return *this ;
58
62
}
59
63
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ class ParamDescView : public ParamDescReadAPI {
34
34
public:
35
35
explicit ParamDescView (model_parser::Buffer* buf) {
36
36
CHECK (buf) << " The pointer in buf can not be nullptr" ;
37
+ flatbuffers::Verifier verifier (static_cast <const uint8_t *>(buf->data ()),
38
+ buf->size ());
39
+ CHECK (verifier.VerifyBuffer <paddle::lite::fbs::proto::ParamDesc>(nullptr ))
40
+ << " Param verification failed." ;
37
41
desc_ =
38
42
flatbuffers::GetRoot<paddle::lite::fbs::proto::ParamDesc>(buf->data ());
39
43
Init ();
@@ -92,6 +96,11 @@ class CombinedParamsDescView : public CombinedParamsDescReadAPI {
92
96
}
93
97
94
98
void InitParams () {
99
+ flatbuffers::Verifier verifier (static_cast <const uint8_t *>(buf_.data ()),
100
+ buf_.size ());
101
+ CHECK (verifier.VerifyBuffer <paddle::lite::fbs::proto::CombinedParamsDesc>(
102
+ nullptr ))
103
+ << " CombinedParamsDesc verification failed." ;
95
104
desc_ = proto::GetCombinedParamsDesc (buf_.data ());
96
105
CHECK (desc_);
97
106
CHECK (desc_->params ());
Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ class ProgramDescView : public ProgramDescAPI {
44
44
}
45
45
46
46
void InitProgramDesc () {
47
+ flatbuffers::Verifier verifier (static_cast <const uint8_t *>(buf_.data ()),
48
+ buf_.size ());
49
+ CHECK (verifier.VerifyBuffer <paddle::lite::fbs::proto::ProgramDesc>(nullptr ))
50
+ << " Program verification failed." ;
47
51
desc_ = proto::GetProgramDesc (buf_.data ());
48
52
blocks_.resize (desc_->blocks ()->size ());
49
53
for (size_t idx = 0 ; idx < BlocksSize (); ++idx) {
You can’t perform that action at this time.
0 commit comments