Skip to content

Commit c4691fc

Browse files
Sergey Komarovjengelh
authored andcommitted
mapi_lib: silence cov-scan warning about overflow in skel_find_rtf
CID 1558693: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW) 16. overflow_const: Expression rtf_len, where unc_size is known to be equal to -1, underflows the type of rtf_len, which is type size_t.
1 parent 592654d commit c4691fc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/mapi/oxcmail.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3066,8 +3066,11 @@ static bool skel_find_rtf(mime_skeleton &skel, const message_content &msg,
30663066
return true;
30673067
ssize_t unc_size = rtfcp_uncompressed_size(rtf);
30683068
std::string buf;
3069-
if (unc_size >= 0)
3070-
buf.resize(unc_size);
3069+
if (unc_size < 0) {
3070+
skel.mail_type = oxcmail_type::tnef;
3071+
return true;
3072+
}
3073+
buf.resize(unc_size);
30713074
size_t rtf_len = unc_size;
30723075
if (unc_size < 0 || !rtfcp_uncompress(rtf, buf.data(), &rtf_len)) {
30733076
skel.mail_type = oxcmail_type::tnef;

0 commit comments

Comments
 (0)