Fix a few issues which can lead to undefined-behaviour (#1730)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
This commit is contained in:
@@ -126,7 +126,8 @@ re_bytecode_list_insert (re_bytecode_ctx_t *bc_ctx_p, /**< RegExp bytecode conte
|
||||
inline ecma_char_t __attr_always_inline___
|
||||
re_get_char (uint8_t **bc_p) /**< pointer to bytecode start */
|
||||
{
|
||||
ecma_char_t chr = *((ecma_char_t *) *bc_p);
|
||||
ecma_char_t chr;
|
||||
memcpy (&chr, *bc_p, sizeof (ecma_char_t));
|
||||
(*bc_p) += sizeof (ecma_char_t);
|
||||
return chr;
|
||||
} /* re_get_char */
|
||||
@@ -152,7 +153,8 @@ re_get_opcode (uint8_t **bc_p) /**< pointer to bytecode start */
|
||||
inline uint32_t __attr_always_inline___
|
||||
re_get_value (uint8_t **bc_p) /**< pointer to bytecode start */
|
||||
{
|
||||
uint32_t value = *((uint32_t *) *bc_p);
|
||||
uint32_t value;
|
||||
memcpy (&value, *bc_p, sizeof (uint32_t));
|
||||
(*bc_p) += sizeof (uint32_t);
|
||||
return value;
|
||||
} /* re_get_value */
|
||||
|
||||
Reference in New Issue
Block a user