Skip to content

Comments

Also reject negative format values in APCuIterator#475

Open
TysonAndre wants to merge 1 commit intokrakjoe:masterfrom
TysonAndre:format-negative
Open

Also reject negative format values in APCuIterator#475
TysonAndre wants to merge 1 commit intokrakjoe:masterfrom
TysonAndre:format-negative

Conversation

@TysonAndre
Copy link
Contributor

This would affect applications that accidentally or deliberately pass in negative values for $format (e.g. PHP_INT_MIN on 64-bit builds)

	if (format > APC_ITER_ALL) { /* 0xffffffff */
		apc_error("APCUIterator format is invalid");
		return;
	}

@nikic
Copy link
Collaborator

nikic commented Nov 13, 2022

Doesn't looks that this error condition is tested currently, add one?

This would affect applications that accidentally or deliberately pass in
negative values for $format (e.g. PHP_INT_MIN on 64-bit builds)

The apc_error macro surprisingly calls php_verror, which is a fatal error.
Switch this to zend_throw_error instead - this still supports PHP 8.0 so
ValueError is too new.
@nikic
Copy link
Collaborator

nikic commented Nov 14, 2022

Looks like apc_099.phpt is failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants