624 Commits

Author SHA1 Message Date
Yuval Hager
a77b49dcb8 silence clang-7 self-assign-overloaded warning 2018-10-26 14:58:57 -07:00
Lele Gaifax
91d50c849d Add test case on kParseNumbersAsStringsFlag being able to load big ints
See issue #1368.
2018-10-08 10:21:25 +02:00
Milo Yip
f5f6052c56
Merge pull request #1327 from gongminmin/FixCompileInVS
Fix the compiling problems in VS
2018-09-10 11:23:26 +08:00
Milo Yip
08b1a8a41e
Merge pull request #1302 from chwarr/min-max-guard
Guard against min/max being macros in reader.h
2018-09-10 11:22:28 +08:00
Lele Gaifax
c9eabf9e13 Extend the test on issue #1336 to cover all basic types 2018-08-05 09:44:15 +02:00
Lele Gaifax
3fc9299b84 Add simple test for issue #1336 2018-08-03 12:34:03 +02:00
Veselin Georgiev
748a652f04 Fix SIGBUS due to unaligned access
Update RAPIDJSON_ALIGN() to always align on an 8-byte boundary
unless otherwise overridden.

On some platforms (such as ARM), 64-bit items (such as doubles and
64-bit integers) must be aligned to an 8 byte address, even though the
architecture is only 32-bits. On these platforms, MemoryPoolAllocator
must match the malloc() behavior and return a 8 byte aligned allocation.
This eliminates any alignment issues that may occur at the expense of
additional memory overhead.

Failure to do so caused a SIGBUS signal when calling
GenericValue::SetNull(). The size of the data_ member of the
GenericValue class is 16 bytes in 32-bit mode and its constructor
requires an 8-byte aligned access.

While parsing a JSON formatted string using Document::ParseStream(), a
stack object containing GenericValue items was constructed. Since the
stack was 8-byte aligned, the constructor calls would succeed. When the
lifetime of the object ends, SetObjectRaw() is invoked. This triggered
an allocation with 4-byte alignment to which the previously 8-byte
aligned GenericValue array was copied. After this, any call to a
GenericValue API that triggered the constructor and thus the placement
new operation on the Data type member would trigger a SIGBUS.

Signed-off-by: Veselin Georgiev <veselin.georgiev@garmin.com>
Signed-off-by: Joshua Watt <Joshua.Watt@garmin.com>
2018-07-31 09:02:26 -05:00
Minmin Gong
ff76343336 Update the code to adapt the new gtest. 2018-07-16 20:36:20 -07:00
Philipp A Hartmann
a26267d16d Fix -Wsign-conversion warnings/errors
GCC 8 (incorrectly) warns about sign conversions in (constant)
array size expressions:

error: conversion to 'long unsigned int' from 'int' may
change the sign of the result [-Werror=sign-conversion]
     char schemaBuffer_[128 * 1024];

Make these expressions unsigned by adding a 'u' suffix to
the first operands.
2018-07-15 16:01:02 +02:00
Christopher Warrington
960b9cfd19 Guard against min/max being macros in reader.h
Sometimes, particularly when Microsoft's windows.h is included, min/max
are defined as macros, interfering with use of
std::numeric_limits::min() and the like.

To guard against this, the function name is wrapped in an extra set of
parenthesis, which inhibits function-style macro expansion.

This is a similar commit to 6e38649ec6, but fixes uses of
std::numeric_limits added after that commit, like those introduced in
2ea43433e2.
2018-07-10 11:08:41 -07:00
Milo Yip
7e68aa0a21
Merge pull request #1252 from StilesCrisis/issue-1251-test
Unit Test: Parsing "128.74836467836484838364836483643636483648e-336" causes a crash
2018-06-19 12:43:54 +08:00
Milo Yip
c511ce303f
Merge pull request #1250 from StilesCrisis/issue-1249-test
Unit Test: Parsing "0e100" in full precision mode causes UB
2018-06-18 23:54:53 +08:00
abolz
7101911d9b Run all the new tests in full-precision mode only
until I know what the normal-precision algorithm really does...
2018-06-16 15:23:44 +02:00
abolz
319944a11a Disable failing test for now 2018-06-16 14:55:07 +02:00
abolz
a757a2aeb8 Add more tests
Some more need to be fixed.
2018-06-16 14:31:48 +02:00
abolz
179277817d Add a test for BigInteger::operator<< 2018-06-16 13:48:33 +02:00
abolz
a0f9c5fc46 [Debug - clean up] 2018-06-16 12:32:17 +02:00
abolz
8b98f4a782 Workaround incorrect rounding in MSVC 2018-06-16 09:40:40 +02:00
abolz
292f787c04 [Debug] 2018-06-15 15:10:50 +02:00
abolz
a78c8e3a4f Add more tests (which need to be fixed) 2018-06-15 12:59:39 +02:00
abolz
7acbb87c2b Some more tests 2018-06-15 11:39:45 +02:00
abolz
4e9b4f6d6a Return 0 if binary exponent is too small 2018-06-15 11:32:32 +02:00
abolz
80dba56aca Add tests for issues with string-to-double conversions (#849, #1249, #1251, #1253, #1256, #1259) 2018-06-15 10:15:45 +02:00
bogaotory
6f7dcb30d9 again, in relation to solving issue #784, use SizeType-typed variable to indicate a none-zero length string has been given in the schema as default value for the json property; added an unittest Object_Required_PassWithDefault 2018-06-01 21:16:26 +01:00
Florin Malita
8269bc2bc2 Prevent int underflow when parsing exponents
When parsing negative exponents, the current implementation takes
precautions for |exp| to not underflow int.

But that is not sufficient: later on [1], |exp + expFrac| is also
stored to an int - so we must ensure that the sum stays within int
representable values.

Update the exp clamping logic to take expFrac into account.

[1] https://github.com/Tencent/rapidjson/blob/master/include/rapidjson/reader.h#L1690
2018-05-15 22:48:07 -04:00
John Stiles
1329cdecce Added test for issue #1251 2018-05-11 15:57:11 -07:00
John Stiles
cad3805737
Update readertest.cpp 2018-05-11 15:19:11 -07:00
John Stiles
f7d2cd2228 added test for parsing 0e100 2018-05-11 15:16:46 -07:00
Zoltan Kovago
0fdd8040ce fix compilation on windows with clang 2018-04-09 15:47:17 +02:00
Christian Semmler
9640209f78 remove superfluous typename 2018-03-26 13:29:52 +02:00
Christian Semmler
f8c8c32b42 fix C++03 compatibility 2018-03-26 13:16:31 +02:00
Christian Semmler
c8530d022f add test case for remote ref issue 2018-03-26 13:04:35 +02:00
MaximeBF
27424d5c09 Change long/ulong as int/uint on MSC unit tests to be more inline with other templated functions unit tests 2018-03-14 08:44:00 -04:00
MaximeBF
a37f9d1ecd Fix unsigned long as unsigned unit test 2018-03-08 07:33:26 -05:00
MaximeBF
a040fc3347 Add unittest for long as int in MSC platforms 2018-03-08 07:28:51 -05:00
Milo Yip
966987625c Add transcoding/validation to Writer::RawValue()
Fix #1152
2018-02-13 10:58:41 +08:00
Milo Yip
daabb88e00
Merge pull request #1068 from yurikhan/violationDetails
Schema violation details
2018-01-26 11:26:27 +08:00
Milo Yip
7641af690e
Merge pull request #1122 from svart-riddare/issue-1108
Suggestion for issue #1108
2018-01-26 10:59:11 +08:00
Milo Yip
b1e556d713
Merge branch 'master' into violationDetails 2018-01-13 22:34:58 +08:00
Milo Yip
03f5de9d7e
Merge pull request #1065 from yurikhan/invalidSchemaPointer
Fix reported violated schema pointer when that schema is remote
2018-01-13 21:17:56 +08:00
Milo Yip
d48290e387 Another try to fix travis build 2018-01-13 12:51:24 +08:00
Milo Yip
0d95d58f8b Try to fix travis build 2018-01-13 12:37:01 +08:00
Étienne Dupuis
44f2f9aa53 Added relevant unit tests for issue #1108 suggested improvement. 2017-11-27 10:38:01 +01:00
Yuri Khan
8c182e51e7 Flatten allOf keyword violations 2017-09-30 20:16:03 +07:00
KaitoHH
66541b8926 add unit test for cursorstreamwrapper 2017-09-29 17:24:07 +08:00
Yuri Khan
0566716802 Extend schema validation tests to compare error object 2017-09-24 12:56:55 +07:00
Yuri Khan
c2371584a0 Keep schema URI in GenericSchemaDocument and internal::Schema 2017-09-23 21:36:07 +07:00
Yuri Khan
379b337444 Add failing test for the case when a remote schema is violated (#1064) 2017-09-16 17:09:08 +07:00
Milo Yip
4a2f2729f1 Change from miloyip/rapidjson to Tencent/rapidjson 2017-09-13 17:03:23 +08:00
Christopher Warrington
e4c0ecf86b Guard against min/max macros in tests too 2017-09-05 18:27:02 -07:00