[PECL-CVS] [pecl-web_services-oauth] fix-callback-exception-segfault: address reviews
[email protected] (Rasmus Lerdorf) Sat, 4 Apr 2026 21:30:16 +0000
| Newsgroups | php.pecl.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Rasmus Lerdorf (rlerdorf)
Date: 2026-04-04T17:30:11-04:00
Commit: https://github.com/php/pecl-web_services-oauth/commit/2528f2bf65bb2f12635844b2d23628597ef77fba
Raw diff: https://github.com/php/pecl-web_services-oauth/commit/2528f2bf65bb2f12635844b2d23628597ef77fba.diff
address reviews
Changed paths:
M provider.c
M provider.h
Diff:
diff --git a/provider.c b/provider.c
index d9808b7..da09647 100644
--- a/provider.c
+++ b/provider.c
@@ -384,9 +384,10 @@ static zval *oauth_provider_call_cb(INTERNAL_FUNCTION_PARAMETERS, int type) /* {
zval_ptr_dtor(&args);
/* If the callback threw an exception, return_value may be in an
- * undefined state. Return NULL so callers don't try to use it.
- * See issue #27. */
+ * undefined state. Reset it and return NULL so callers don't try
+ * to use or destroy a corrupt zval. See issue #27. */
if (EG(exception)) {
+ ZVAL_UNDEF(return_value);
return NULL;
}
diff --git a/provider.h b/provider.h
index a2b44cb..f4d7e2e 100644
--- a/provider.h
+++ b/provider.h
@@ -26,12 +26,12 @@
OAUTH_PROVIDER_COPY_ZVAL_FROM_PZVAL(dest, src, 0)
#define OAUTH_PROVIDER_CALL_CB(pt, m) \
- { \
+ do { \
zval *_cb_ret = oauth_provider_call_cb(pt, m); \
if (_cb_ret) { \
ZVAL_DUP(return_value, _cb_ret); \
} \
- }
+ } while (0)
#define OAUTH_PROVIDER_FREE_FCALL_INFO(o) \
if(o) { \