Skip to content

Commit 138072b

Browse files
committed
Fixes from review by @zxcvdavid
1 parent 0ecf768 commit 138072b

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

msgpack_class.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,8 @@ static ZEND_METHOD(msgpack_unpacker, feed)
363363
static ZEND_METHOD(msgpack_unpacker, execute)
364364
{
365365
char *str = NULL, *data;
366-
long str_len = 0;
366+
size_t len, off, str_len = 0;
367367
int ret, error_display = MSGPACK_G(error_display), php_only = MSGPACK_G(php_only);
368-
size_t len, off;
369368
zval *offset = NULL;
370369
php_msgpack_unpacker_t *unpacker = Z_MSGPACK_UNPACKER_P(getThis());
371370

@@ -376,7 +375,7 @@ static ZEND_METHOD(msgpack_unpacker, execute)
376375
if (str) {
377376
data = str;
378377
len = str_len;
379-
if (offset != NULL) {
378+
if (offset != NULL && (Z_TYPE_P(offset) == IS_LONG || Z_TYPE_P(offset) == IS_DOUBLE)) {
380379
off = Z_LVAL_P(offset);
381380
} else {
382381
off = 0;
@@ -457,9 +456,6 @@ static ZEND_METHOD(msgpack_unpacker, data)
457456
ZVAL_STRING(&func_name, "reset");
458457
call_user_function_ex(CG(function_table), getThis(), &func_name, &reset_return, 0, NULL, 0, NULL);
459458
zval_ptr_dtor(&func_name);
460-
461-
return;
462-
RETURN_FALSE;
463459
}
464460

465461
static ZEND_METHOD(msgpack_unpacker, reset)

msgpack_convert.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ inline int msgpack_convert_long_to_properties(
8080
return SUCCESS;
8181
}
8282

83-
static inline int msgpack_convert_string_to_properties(
83+
static inline int msgpack_convert_string_to_properties(
8484
zval *object, char *key, uint key_len, zval *val, HashTable *var)
8585
{
8686
zend_class_entry *ce = Z_OBJCE_P(object);

0 commit comments

Comments
 (0)