Skip to content

soap: reject self-referential schema group and attributeGroup fix-up - #23600

Open
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:promote/soap-schema-selfref
Open

soap: reject self-referential schema group and attributeGroup fix-up#23600
iliaal wants to merge 1 commit into
php:PHP-8.4from
iliaal:promote/soap-schema-selfref

Conversation

@iliaal

@iliaal iliaal commented Sep 6, 2026

Copy link
Copy Markdown
Member

schema_content_model_fixup() and schema_attributegroup_fixup() follow a group ref back into schema_type_fixup() with nothing tracking which types are already being fixed up, so a schema whose group or attributeGroup references itself recurses until the C stack is exhausted. The sdl context now tracks the in-progress types and raises a parse error when one is re-entered.

Both tests segfault without the change.

@iliaal
iliaal requested a review from devnexen as a code owner September 6, 2026 15:07
@iliaal
iliaal force-pushed the promote/soap-schema-selfref branch from 18c8e78 to 183f99d Compare September 6, 2026 15:08
iliaal added a commit to iliaal/php-src that referenced this pull request Sep 6, 2026
schema_content_model_fixup() and schema_attributegroup_fixup() followed a
group ref back into schema_type_fixup() with nothing tracking the types
already being fixed up, so a schema whose group references itself
recursed until the C stack ran out. Track the in-progress types in the
sdl context and raise a parse error when one is re-entered.

Closes phpGH-23600
Comment thread ext/soap/tests/schema-selfref-attrgroup.phpt
Comment thread ext/soap/tests/schema-selfref-group.phpt Outdated
Comment thread ext/soap/php_schema.c
if (ctx->attributeGroups != NULL) {
tmp = (sdlTypePtr)schema_find_by_ref(ctx->attributeGroups, attr->ref);
if (tmp) {
if (zend_hash_index_find_ptr(&ctx->fixupInProgress, (zend_ulong)tmp) != NULL) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: when you merge up to master, should be

(zend_ulong)(uintptr_t)tmp

iliaal added a commit to iliaal/php-src that referenced this pull request Sep 6, 2026
schema_content_model_fixup() and schema_attributegroup_fixup() followed a
group ref back into schema_type_fixup() with nothing tracking the types
already being fixed up, so a schema whose group references itself
recursed until the C stack ran out. Track the in-progress types in the
sdl context and raise a parse error when one is re-entered.

Closes phpGH-23600
@iliaal
iliaal force-pushed the promote/soap-schema-selfref branch from 183f99d to a616627 Compare September 6, 2026 20:59
schema_content_model_fixup() and schema_attributegroup_fixup() followed a
group ref back into schema_type_fixup() with nothing tracking the types
already being fixed up, so a schema whose group references itself
recursed until the C stack ran out. Track the in-progress types in the
sdl context and raise a parse error when one is re-entered.

Closes phpGH-23600
@iliaal
iliaal force-pushed the promote/soap-schema-selfref branch from a616627 to b8946c2 Compare September 6, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants