Add bounds checks to the parsing utilities. (#5421)

* Add bounds checks to the parsing utilities.

* Fix merge conflicts in ACLoader.

* Fix loaders

* Fix unittest of AC-Loader.

* Remove dead code.

* Md5Parser fixes

* Fix md5-parsing

* Fix Merge conflict

* Fix merge conflicts.

* Md5: Fix warning: missing return statement.
This commit is contained in:
Kim Kulling
2024-01-30 14:32:41 +01:00
committed by GitHub
parent d5f35582d4
commit c08e3b4abb
39 changed files with 853 additions and 782 deletions

View File

@@ -199,35 +199,27 @@ public:
}
public:
/** parse a variable from a string and set 'inout' to the character
* behind the last consumed character. An optional schema enables,
* if specified, automatic conversion of custom data types.
*
* @throw SyntaxError
*/
static std::shared_ptr<const EXPRESS::DataType> Parse(const char *&inout,
uint64_t line = SyntaxError::LINE_NOT_SPECIFIED,
const EXPRESS::ConversionSchema *schema = nullptr);
/// @brief Parse a variable from a string and set 'inout' to the character behind the last consumed character.
///
/// An optional schema enables, if specified, automatic conversion of custom data types.
///
/// @throw SyntaxError
static std::shared_ptr<const EXPRESS::DataType> Parse(const char *&inout, const char *end,
uint64_t line = SyntaxError::LINE_NOT_SPECIFIED, const EXPRESS::ConversionSchema *schema = nullptr);
};
typedef DataType SELECT;
typedef DataType LOGICAL;
// -------------------------------------------------------------------------------
/** Sentinel class to represent explicitly unset (optional) fields ($) */
/// Sentinel class to represent explicitly unset (optional) fields ($)
// -------------------------------------------------------------------------------
class UNSET : public DataType {
public:
private:
};
class UNSET : public DataType {};
// -------------------------------------------------------------------------------
/** Sentinel class to represent explicitly derived fields (*) */
/// Sentinel class to represent explicitly derived fields (*)
// -------------------------------------------------------------------------------
class ISDERIVED : public DataType {
public:
private:
};
class ISDERIVED : public DataType {};
// -------------------------------------------------------------------------------
/** Shared implementation for some of the primitive data type, i.e. int, float
@@ -304,7 +296,7 @@ public:
public:
/** @see DaraType::Parse
*/
static std::shared_ptr<const EXPRESS::LIST> Parse(const char *&inout,
static std::shared_ptr<const EXPRESS::LIST> Parse(const char *&inout, const char *end,
uint64_t line = SyntaxError::LINE_NOT_SPECIFIED,
const EXPRESS::ConversionSchema *schema = nullptr);