Skip Menu |

This queue is for tickets about the WWW-Curl CPAN distribution.

Report information
The Basics
Id: 94637
Status: patched
Priority: 0/
Queue: WWW-Curl

People
Owner: szbalint [...] cpan.org
Requestors: jplesnik [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 4.09
Fixed in: (no value)



Subject: Dead code at Curl.XS
There is a dead code at Curl.XS. I found it at 4.09 and it is also present at the latest stable release. Could you please fix it or let me know if I miss anything? 1245 #if (LIBCURL_VERSION_NUM>=0x070a03) 1246 switch(option) { 1247 /* slist cases */ 1248 case CURLSHOPT_SHARE: 1249 case CURLSHOPT_UNSHARE: 1250 if (option < CURLOPTTYPE_OBJECTPOINT) { /* An integer value: */ 1251 RETVAL = curl_share_setopt(self->curlsh, option, (long)SvIV(value)); 1252 } else { /* A char * value: */ 1253 /* FIXME: Does curl really want NULL for empty strings? */ 1254 STRLEN dummy; 1255 char *pv = SvPV(value, dummy); 1256 RETVAL = curl_share_setopt(self->curlsh, option, *pv ? pv : NULL); 1257 }; 1258 break; 1259 }; 1260 #else 1261 croak("curl_share_setopt not supported in your libcurl version"); 1262 #endif CURLSHOPT_SHARE = 1 CURLSHOPT_UNSHARE = 2 CURLOPTTYPE_OBJECTPOINT = 10000 At condition "option < 10000", the value of "option" must be between 1 and 2. So, execution cannot reach this statement "STRLEN dummy;" on line 1254.
On Fri Apr 11 07:00:51 2014, jplesnik wrote: Show quoted text
> There is a dead code at Curl.XS. I found it at 4.09 and it is also > present at the latest stable release. > > Could you please fix it or let me know if I miss anything? > > 1245 #if (LIBCURL_VERSION_NUM>=0x070a03) > 1246 switch(option) { > 1247 /* slist cases */ > 1248 case CURLSHOPT_SHARE: > 1249 case CURLSHOPT_UNSHARE: > 1250 if (option < CURLOPTTYPE_OBJECTPOINT) { /* An > integer value: */ > 1251 RETVAL = curl_share_setopt(self->curlsh, > option, (long)SvIV(value)); > 1252 } else { /* A char * value: */ > 1253 /* FIXME: Does curl really want NULL for > empty strings? */ > 1254 STRLEN dummy; > 1255 char *pv = SvPV(value, dummy); > 1256 RETVAL = curl_share_setopt(self->curlsh, > option, *pv ? pv : NULL); > 1257 }; > 1258 break; > 1259 }; > 1260 #else > 1261 croak("curl_share_setopt not supported in your libcurl > version"); > 1262 #endif > > CURLSHOPT_SHARE = 1 > CURLSHOPT_UNSHARE = 2 > CURLOPTTYPE_OBJECTPOINT = 10000 > > At condition "option < 10000", the value of "option" must be between 1 > and 2. So, execution cannot reach this statement "STRLEN dummy;" on > line 1254.
Thanks for this bugreport! The code does look cargo culted, I've simplified it a bit and pushed to github. It'll appear in the next release.