I've touched HttpTransact.cc in the past 24 hours, but didn't change anything that would obviously trigger these new warnings.

Looks like we should be null checking the results of find_field, but that logic doesn't seem to have changed. So don't know why coverity is complaining now.

On 1/23/2015 2:23 PM, Leif Hedstrom wrote:
Anyone recognize these three new Coverity errors as part of their recent (~24h) 
commits?

— Leif


Begin forwarded message:

Date: January 23, 2015 at 2:59:10 AM MST
From: scan-ad...@coverity.com
To: zw...@apache.org
Subject: New Defects reported by Coverity Scan for Apache Traffic Server


Hi,

Please find the latest report on new defect(s) introduced to Apache Traffic 
Server found with Coverity Scan.

3 new defect(s) introduced to Apache Traffic Server found with Coverity Scan.


New defect(s) Reported-by: Coverity Scan
Showing 3 of 3 defect(s)


** CID 1021868:  Dereference null return value  (NULL_RETURNS)
/proxy/hdrs/HdrTest.cc: 610 in HdrTest::test_mime()()

** CID 1021867:  Dereference null return value  (NULL_RETURNS)
/proxy/http/HttpTransact.cc: 7744 in 
HttpTransact::build_response(HttpTransact::State *, HTTPHdr *, HTTPHdr *, 
HTTPVersion, HTTPStatus, const char *)()

** CID 1021866:  Dereference null return value  (NULL_RETURNS)
/proxy/http/HttpTransact.cc: 5574 in 
HttpTransact::initialize_state_variables_from_response(HttpTransact::State *, 
HTTPHdr *)()


________________________________________________________________________________________________________
*** CID 1021868:  Dereference null return value  (NULL_RETURNS)
/proxy/hdrs/HdrTest.cc: 610 in HdrTest::test_mime()()
604
605       hdr.value_append("Cache-Control", 13, "no-cache", 8, 1);
606
607       MIMEField *cc_field;
608       StrList slist;
609
    CID 1021868:  Dereference null return value  (NULL_RETURNS)
    Assigning: "cc_field" = null return value from "field_find".
610       cc_field = hdr.field_find("Cache-Control", 13);
611       // TODO: Do we need to check the "count" returned?
612       cc_field->value_get_comma_list(&slist); // FIX: correct usage?
613
614       if (cc_field->value_get_index("Private", 7) < 0) {
615         printf("Failed: value_get_index of Cache-Control did not find 
private");

________________________________________________________________________________________________________
*** CID 1021867:  Dereference null return value  (NULL_RETURNS)
/proxy/http/HttpTransact.cc: 7744 in 
HttpTransact::build_response(HttpTransact::State *, HTTPHdr *, HTTPHdr *, 
HTTPVersion, HTTPStatus, const char *)()
7738               MIMEField *field;
7739               int len;
7740               const char *value;
7741
7742               for (size_t i = 0; i < sizeof(field_len) / 
sizeof(field_len[0]); i++) {
7743                 if (base_response->presence(field_presence[i])) {
    CID 1021867:  Dereference null return value  (NULL_RETURNS)
    Assigning: "field" = null return value from "field_find".
7744                   field = base_response->field_find(field_name[i], 
field_len[i]);
7745                   value = field->value_get(&len);
7746                   outgoing_response->value_append(field_name[i], 
field_len[i], value, len, 0);
7747                 }
7748               }
7749             }

________________________________________________________________________________________________________
*** CID 1021866:  Dereference null return value  (NULL_RETURNS)
/proxy/http/HttpTransact.cc: 5574 in 
HttpTransact::initialize_state_variables_from_response(HttpTransact::State *, 
HTTPHdr *)()
5568           s->hdr_info.response_content_length = HTTP_UNDEFINED_CL;
5569           s->hdr_info.trust_response_cl = false;
5570         }
5571       }
5572
5573       if (incoming_response->presence(MIME_PRESENCE_TRANSFER_ENCODING)) {
    CID 1021866:  Dereference null return value  (NULL_RETURNS)
    Assigning: "field" = null return value from "field_find".
5574         MIMEField *field = 
incoming_response->field_find(MIME_FIELD_TRANSFER_ENCODING, 
MIME_LEN_TRANSFER_ENCODING);
5575
5576         HdrCsvIter enc_val_iter;
5577         int enc_val_len;
5578         const char *enc_value = enc_val_iter.get_first(field, 
&enc_val_len);
5579


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, 
http://scan.coverity.com/projects/431?tab=overview

To manage Coverity Scan email notifications for "zw...@apache.org", click 
http://scan.coverity.com/subscriptions/edit?email=zwoop%40apache.org&token=8be94e3735d9c9bbfac2f59f1eb24e15
 .



Reply via email to