check for NULL on any valid ION type
authorMichael Wallner <mike@php.net>
Tue, 14 Dec 2021 11:38:25 +0000 (12:38 +0100)
committerMichael Wallner <mike@php.net>
Tue, 14 Dec 2021 11:54:08 +0000 (12:54 +0100)
ion_private.h

index 93b3058280c29d12149229564aeaa29d70794c9c..5ca03dab2c63cbd16689bbedbbc2fa7d1dbc744b 100644 (file)
@@ -1763,6 +1763,14 @@ static inline void php_ion_unserialize_zval(php_ion_unserializer *ser, zval *ret
                ZVAL_DEREF(return_value);
        }
 
+       if (ION_TYPE_INT(*typ) > 0) {
+               BOOL is_null;
+               ION_CHECK(ion_reader_is_null(ser->reader, &is_null));
+               if (is_null) {
+                       RETURN_NULL();
+               }
+       }
+
        switch (ION_TYPE_INT(*typ)) {
        case tid_NULL_INT:
                ION_CHECK(ion_reader_read_null(ser->reader, typ));