File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ class Stack {
126
126
127
127
template <typename T>
128
128
RAPIDJSON_FORCEINLINE T* PushUnsafe (size_t count = 1 ) {
129
+ RAPIDJSON_ASSERT (stackTop_);
129
130
RAPIDJSON_ASSERT (stackTop_ + sizeof (T) * count <= stackEnd_);
130
131
T* ret = reinterpret_cast <T*>(stackTop_);
131
132
stackTop_ += sizeof (T) * count;
Original file line number Diff line number Diff line change @@ -934,11 +934,13 @@ class GenericReader {
934
934
#else
935
935
length = static_cast <SizeType>(__builtin_ffs (r) - 1 );
936
936
#endif
937
- char * q = reinterpret_cast <char *>(os.Push (length));
938
- for (size_t i = 0 ; i < length; i++)
939
- q[i] = p[i];
937
+ if (length != 0 ) {
938
+ char * q = reinterpret_cast <char *>(os.Push (length));
939
+ for (size_t i = 0 ; i < length; i++)
940
+ q[i] = p[i];
940
941
941
- p += length;
942
+ p += length;
943
+ }
942
944
break ;
943
945
}
944
946
_mm_storeu_si128 (reinterpret_cast <__m128i *>(os.Push (16 )), s);
You can’t perform that action at this time.
0 commit comments