Skip to content

Commit

Permalink
match type of var_entries.used_slots
Browse files Browse the repository at this point in the history
`used_slots` and iteration variable `i` did not use matching types causing crashes

this fixes this and changes the types to `zend_long` to match the same struct used in var_unserializer.c in PHP.
  • Loading branch information
Marlies Heijkoop authored and Sean-Der committed Dec 7, 2016
1 parent e932088 commit e181560
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions msgpack_unpack.c
Expand Up @@ -11,7 +11,7 @@

typedef struct {
zval data[VAR_ENTRIES_MAX];
int32_t used_slots;
zend_long used_slots;
void *next;
} var_entries;

Expand Down Expand Up @@ -98,7 +98,7 @@ static inline void msgpack_var_replace(zval *old, zval *new) /* {{{ */ {
}
/* }}} */

static zval *msgpack_var_access(msgpack_unserialize_data_t *var_hashx, long id) /* {{{ */ {
static zval *msgpack_var_access(msgpack_unserialize_data_t *var_hashx, zend_long id) /* {{{ */ {
var_entries *var_hash = var_hashx->first;

while (id >= VAR_ENTRIES_MAX && var_hash && var_hash->used_slots == VAR_ENTRIES_MAX) {
Expand Down Expand Up @@ -280,7 +280,7 @@ void msgpack_unserialize_var_init(msgpack_unserialize_data_t *var_hashx) /* {{{
/* }}} */

void msgpack_unserialize_var_destroy(msgpack_unserialize_data_t *var_hashx, zend_bool err) /* {{{ */ {
size_t i;
zend_long i;
void *next;
var_entries *var_hash = var_hashx->first;

Expand Down

0 comments on commit e181560

Please sign in to comment.