mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-23 06:00:01 +00:00
[idl_parser] Validate force_align on all possible paths (#6430)
* [idl_parser] Validate `force_align` on all possible paths - added validation of `force_align` for `Vector`. - added assertion to `flatbuffers::PreAlign` method These changes should resolve following oss-fuzz issues: - 6275816289861632 - 5713529908887552 - 4761242994606080 * size_t problem on Mac * Fix review notes
This commit is contained in:
@@ -335,6 +335,9 @@ inline bool StringToFloatImpl(T *val, const char *const str) {
|
||||
// - If the converted value falls out of range of corresponding return type, a
|
||||
// range error occurs. In this case value MAX(T)/MIN(T) is returned.
|
||||
template<typename T> inline bool StringToNumber(const char *s, T *val) {
|
||||
// Assert on `unsigned long` and `signed long` on LP64.
|
||||
// If it is necessary, it could be solved with flatbuffers::enable_if<B,T>.
|
||||
static_assert(sizeof(T) < sizeof(int64_t), "unexpected type T");
|
||||
FLATBUFFERS_ASSERT(s && val);
|
||||
int64_t i64;
|
||||
// The errno check isn't needed, will return MAX/MIN on overflow.
|
||||
|
||||
Reference in New Issue
Block a user