Address Clag Analyzer issues.
Following are the issues related to NetEq 4, discovered by Clang Analyzer.
https://x20web.corp.google.com/~pbos/scan-build-2013-10-10-1/report-b44b95.html#EndPath
Valid; perhaps unlikely, addressed.
https://x20web.corp.google.com/~pbos/scan-build-2013-10-10-1/report-6beef6.html#EndPath
Valid, addressed.
https://x20web.corp.google.com/~pbos/scan-build-2013-10-10-1/report-2e3883.html#EndPath
Valid; Addressed
https://x20web.corp.google.com/~pbos/scan-build-2013-10-10-1/report-293659.html#EndPath
Valid; Addressed.
https://x20web.corp.google.com/~pbos/scan-build-2013-10-10-1/report-b875cd.html#EndPath
Valid; Addressed.
https://x20web.corp.google.com/~pbos/scan-build-2013-10-10-1/index.html
Not valid;
https://x20web.corp.google.com/~pbos/scan-build-2013-10-10-1/report-86f2ed.html#EndPath
Not Valid; the assert statement will be short-circuited, however I also added a check of nullity of |packet|.
https://x20web.corp.google.com/~pbos/scan-build-2013-10-10-1/report-3a5669.html#EndPath
Not Valid: |energy_input| and |energy_expand| are both non-negative, therefore if-statement condition on line 226 is not satisfied unless |energy_input| >= 1. Therefore |energy_input| cannot be zero after normalization to 14-bits, i.e. operations on lines 228 & 229.
https://x20web.corp.google.com/~pbos/scan-build-2013-10-10-1/report-2f914f.html#EndPath
Valid; addressed.
https://x20web.corp.google.com/~pbos/scan-build-2013-10-10-1/report-2332b1.html#EndPath
Valid; addressed.
https://x20web.corp.google.com/~pbos/scan-build-2013-10-10-1/report-de8dea.html#EndPath
Not valid; |out_len| is set when Process() is called, however, it makes sense to initialize to zero when declaring |out_len|.
https://x20web.corp.google.com/~pbos/scan-build-2013-10-10-1/report-b671a3.html#EndPath
Valid; addressed.
BUG=
R=henrik.lundin@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/2729005
git-svn-id: http://webrtc.googlecode.com/svn/trunk@5064 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/neteq4/neteq_impl.cc b/webrtc/modules/audio_coding/neteq4/neteq_impl.cc
index a5c45ff..73ca5e4 100644
--- a/webrtc/modules/audio_coding/neteq4/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq4/neteq_impl.cc
@@ -1259,6 +1259,7 @@
delete[] packet->payload;
delete packet;
+ packet = NULL;
if (decode_length > 0) {
*decoded_length += decode_length;
// Update |decoder_frame_length_| with number of samples per channel.
@@ -1287,10 +1288,10 @@
}
} // End of decode loop.
- // If the list is not empty at this point, it must hold exactly one CNG
- // packet.
- assert(packet_list->empty() ||
- (packet_list->size() == 1 &&
+ // If the list is not empty at this point, either a decoding error terminated
+ // the while-loop, or list must hold exactly one CNG packet.
+ assert(packet_list->empty() || *decoded_length < 0 ||
+ (packet_list->size() == 1 && packet &&
decoder_database_->IsComfortNoise(packet->header.payloadType)));
return 0;
}