Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-1698

prep_tagsets may leak in convert_to_object

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.9.0-rc1, 1.9.0
    • Affects Version/s: None
    • Component/s: None
    • None

      While testing PHP 8, I discovered that php_phongo_read_preference_prep_tagsets may leak when invoked via php_phongo_readpreference_init_from_hash. This does not happen when called from ReadPreference's constructor, since the "/" modifier in zpp separates the dedicated tagSets zval; however, __set_state does not separate its argument.

      Rather than rely on zpp, we can work around the leak by separating the tagSets zval in php_phongo_read_preference_prep_tagsets directly.

      This bug likely dates back to PHPC-1206, which is when __set_state was introduced. When was originally implemented in PHPC-851, it was only called from the constructor.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: