From dc4e885f35afed10f941cd7e3090f5d5904078cf Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 8 Oct 2023 10:39:39 +0200 Subject: [PATCH] curl_easy_pause: set "in callback" true on exit if true Because it might have called another callback in the mean time that then set the bit FALSE on exit. Reported-by: Jay Satiro Fixes #12059 Closes #12061 --- lib/easy.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/easy.c b/lib/easy.c index e0bde371f8..6b4fb8efeb 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -1083,11 +1083,14 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action) CURLcode result = CURLE_OK; int oldstate; int newstate; + bool recursive = FALSE; if(!GOOD_EASY_HANDLE(data) || !data->conn) /* crazy input, don't continue */ return CURLE_BAD_FUNCTION_ARGUMENT; + if(Curl_is_in_callback(data)) + recursive = TRUE; k = &data->req; oldstate = k->keepon & (KEEP_RECV_PAUSE| KEEP_SEND_PAUSE); @@ -1154,6 +1157,11 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action) corresponding socket callback, if used */ result = Curl_updatesocket(data); + if(recursive) + /* this might have called a callback recursively which might have set this + to false again on exit */ + Curl_set_in_callback(data, TRUE); + return result; } -- 2.47.3