aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/ext
diff options
context:
space:
mode:
authorGravatar Paul Yang <TeBoring@users.noreply.github.com>2017-04-21 15:00:00 -0700
committerGravatar GitHub <noreply@github.com>2017-04-21 15:00:00 -0700
commit6fff091c49359ffd8550fc8228c79740b504a4fe (patch)
tree590cc44184f197dc5d0d53dfa4954b5f20f76833 /php/ext
parentf418b9e3eb2c986c914ada1869572dd47963ba0d (diff)
Throw exception when parsing invalid data. (#3000)
Diffstat (limited to 'php/ext')
-rw-r--r--php/ext/google/protobuf/encode_decode.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/php/ext/google/protobuf/encode_decode.c b/php/ext/google/protobuf/encode_decode.c
index 06dc1195..28bf18f4 100644
--- a/php/ext/google/protobuf/encode_decode.c
+++ b/php/ext/google/protobuf/encode_decode.c
@@ -261,13 +261,6 @@ static void* appendbytes_handler(void *closure,
#endif
}
- static bool int32_handler(void* closure, const void* hd,
- int32_t val) {
- MessageHeader* msg = (MessageHeader*)closure;
- const size_t *ofs = hd;
- DEREF(message_data(msg), *ofs, int32_t) = val;
- return true;
- }
// Handlers that append primitive values to a repeated field.
#define DEFINE_SINGULAR_HANDLER(type, ctype) \
static bool type##_handler(void* closure, const void* hd, \
@@ -279,7 +272,7 @@ static void* appendbytes_handler(void *closure,
}
DEFINE_SINGULAR_HANDLER(bool, bool)
-// DEFINE_SINGULAR_HANDLER(int32, int32_t)
+DEFINE_SINGULAR_HANDLER(int32, int32_t)
DEFINE_SINGULAR_HANDLER(uint32, uint32_t)
DEFINE_SINGULAR_HANDLER(float, float)
DEFINE_SINGULAR_HANDLER(int64, int64_t)
@@ -1435,6 +1428,7 @@ PHP_METHOD(Message, mergeFromString) {
char *data = NULL;
PHP_PROTO_SIZE data_len;
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) ==
FAILURE) {
return;