Fix some minor Coverity-reported issues (added a check to suppress a warning,

removed an unnecessary check, and removed some dead code)
This commit is contained in:
Michael R Sweet 2021-10-31 07:04:17 -04:00
parent b3ca129a58
commit 9014ab7a20
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244
3 changed files with 15 additions and 14 deletions

View File

@ -222,6 +222,9 @@ _pdfioCryptoAESEncrypt(
size_t outbytes = 0; // Output bytes size_t outbytes = 0; // Output bytes
if (len == 0)
return (0);
if (inbuffer != outbuffer) if (inbuffer != outbuffer)
{ {
// Not the most efficient, but we can optimize later - the sample AES code // Not the most efficient, but we can optimize later - the sample AES code

View File

@ -366,9 +366,7 @@ _pdfioArrayDelete(pdfio_array_t *a) // I - Array
free(a->values[i].value.binary.data); free(a->values[i].value.binary.data);
} }
if (a) free(a->values);
free(a->values);
free(a); free(a);
} }

View File

@ -193,7 +193,7 @@ _pdfioCryptoLock(
} }
pdfioDictSetName(filter_dict, "Type", "CryptFilter"); pdfioDictSetName(filter_dict, "Type", "CryptFilter");
pdfioDictSetName(filter_dict, "CFM", encryption == PDFIO_ENCRYPTION_RC4_128 ? "V2" : "AESV2"); pdfioDictSetName(filter_dict, "CFM", "AESV2");
pdfioDictSetDict(cf_dict, "PDFio", filter_dict); pdfioDictSetDict(cf_dict, "PDFio", filter_dict);
pdfioDictSetDict(dict, "CF", cf_dict); pdfioDictSetDict(dict, "CF", cf_dict);
pdfioDictSetName(dict, "StmF", "PDFio"); pdfioDictSetName(dict, "StmF", "PDFio");