Skip to content

Commit f3c29bf

Browse files
committed
[misc] fix and silence some Coverity warnings
1 parent ec604f4 commit f3c29bf

10 files changed

+30
-15
lines changed

res/loc/po/!update.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@echo off
2-
if not exist pollock.exe curl https://files.akeo.ie/pollock/pollock-1.5.exe --output pollock.exe
2+
if not exist pollock.exe curl https://files.akeo.ie/pollock/pollock-1.6.exe --output pollock.exe
33
cls
44
:menu
55
echo 1 - Import .po into .loc

res/loc/po/fa-IR.po

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ msgstr ""
33
"Project-Id-Version: 4.5\n"
44
"Report-Msgid-Bugs-To: pete@akeo.ie\n"
55
"POT-Creation-Date: 2024-04-29 19:24+0300\n"
6-
"PO-Revision-Date: 2024-04-29 20:25+0330\n"
6+
"PO-Revision-Date: 2025-02-13 12:00+0000\n"
77
"Last-Translator: MasterVito <mv@mvaop.ir>\n"
88
"Language-Team: \n"
99
"Language: fa_IR\n"
@@ -13,7 +13,7 @@ msgstr ""
1313
"X-Poedit-SourceCharset: UTF-8\n"
1414
"X-Rufus-LanguageName: Persian (پارسی)\n"
1515
"X-Rufus-LCID: 0x0429\n"
16-
"X-Generator: Poedit 3.4.2\n"
16+
"X-Generator: Poedit 3.5\n"
1717

1818
#. • IDD_DIALOG → IDS_DRIVE_PROPERTIES_TXT
1919
msgid "Drive Properties"
@@ -1094,7 +1094,7 @@ msgstr "نسخه %d.%d (Build %d)"
10941094

10951095
#. • MSG_176
10961096
msgid "English translation: Pete Batard <mailto:pete@akeo.ie>"
1097-
msgstr "ترجمه فارسی:\\line‏ •سید عرفان <mailto:mv@mvaop.ir>\\line‏ •ضیاءالدین عظیمی <mailto:s.zia.azimi@gmail.com>"
1097+
msgstr "ترجمه فارسی:\\line‏ •مستر ویتو <mailto:mv@mvaop.ir>\\line‏ •ضیاءالدین عظیمی <mailto:s.zia.azimi@gmail.com>"
10981098

10991099
#. • MSG_177
11001100
msgid "Report bugs or request enhancements at:"

res/loc/rufus.loc

+1-1
Original file line numberDiff line numberDiff line change
@@ -10049,7 +10049,7 @@ t MSG_172 "امضای فایل دانلود شده معتبر نیست"
1004910049
t MSG_173 "برای انتخاب کلیک کنید..."
1005010050
t MSG_174 "Rufus، ابزاری کاربردی و قابل‌اطمینان برای فرمت کردن درایوهای USB"
1005110051
t MSG_175 "نسخه %d.%d (Build %d)"
10052-
t MSG_176 "ترجمه فارسی:\\line‏ •سید عرفان <mailto:mv@mvaop.ir>\\line‏ •ضیاءالدین عظیمی <mailto:s.zia.azimi@gmail.com>"
10052+
t MSG_176 "ترجمه فارسی:\\line‏ •مستر ویتو <mailto:mv@mvaop.ir>\\line‏ •ضیاءالدین عظیمی <mailto:s.zia.azimi@gmail.com>"
1005310053
t MSG_177 "گزارش اشکال (Bug) یا درخواست قابلیت جدید و بهبود نرم‌افزار در:"
1005410054
t MSG_178 "حقوق نشر دیگران:"
1005510055
t MSG_179 "سیاست به‌روزرسانی:"

src/bled/huf_decompress.c

+1
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,7 @@ size_t HUF_readDTableX2_wksp(HUF_DTable* DTable,
12081208
if (tableLog <= HUF_DECODER_FAST_TABLELOG && maxTableLog > HUF_DECODER_FAST_TABLELOG) maxTableLog = HUF_DECODER_FAST_TABLELOG;
12091209

12101210
/* find maxWeight */
1211+
// coverity[underflow]
12111212
for (maxW = tableLog; wksp->rankStats[maxW]==0; maxW--) {} /* necessarily finds a solution before 0 */
12121213

12131214
/* Get start index of each weight */

src/bled/xxhash.h

+1
Original file line numberDiff line numberDiff line change
@@ -3402,6 +3402,7 @@ XXH64_finalize(xxh_u64 hash, const xxh_u8* ptr, size_t len, XXH_alignment align)
34023402
hash ^= (xxh_u64)(XXH_get32bits(ptr)) * XXH_PRIME64_1;
34033403
ptr += 4;
34043404
hash = XXH_rotl64(hash, 23) * XXH_PRIME64_2 + XXH_PRIME64_3;
3405+
// coverity[overflow_const]
34053406
len -= 4;
34063407
}
34073408
while (len > 0) {

src/bled/xz_dec_lzma2.c

+1
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ static void XZ_FUNC lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l,
641641
}
642642
}
643643

644+
// coverity[overflow_const]
644645
s->lzma.len += rc_bittree(&s->rc, probs, limit) - limit;
645646
}
646647

src/bled/zstd_decompress.c

+1
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ static size_t ZSTD_decodeFrameHeader(ZSTD_DCtx* dctx, const void* src, size_t he
721721
static ZSTD_frameSizeInfo ZSTD_errorFrameSizeInfo(size_t ret)
722722
{
723723
ZSTD_frameSizeInfo frameSizeInfo;
724+
frameSizeInfo.nbBlocks = 0;
724725
frameSizeInfo.compressedSize = ret;
725726
frameSizeInfo.decompressedBound = ZSTD_CONTENTSIZE_ERROR;
726727
return frameSizeInfo;

src/msapi_utf8.h

+12-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* See also: https://utf8everywhere.org
88
*
9-
* Copyright © 2010-2023 Pete Batard <pete@akeo.ie>
9+
* Copyright © 2010-2025 Pete Batard <pete@akeo.ie>
1010
*
1111
* This library is free software; you can redistribute it and/or
1212
* modify it under the terms of the GNU Lesser General Public
@@ -174,14 +174,24 @@ static __inline DWORD FormatMessageU(DWORD dwFlags, LPCVOID lpSource, DWORD dwMe
174174
DWORD dwLanguageId, char* lpBuffer, DWORD nSize, va_list *Arguments)
175175
{
176176
DWORD ret = 0, err = ERROR_INVALID_DATA;
177-
// coverity[returned_null]
177+
// Exclude support for the FORMAT_MESSAGE_ALLOCATE_BUFFER special case.
178+
if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
179+
SetLastError(ERROR_INVALID_PARAMETER);
180+
return 0;
181+
}
178182
walloc(lpBuffer, nSize);
183+
if (wlpBuffer == NULL) {
184+
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
185+
return 0;
186+
}
179187
ret = FormatMessageW(dwFlags, lpSource, dwMessageId, dwLanguageId, wlpBuffer, nSize, Arguments);
180188
err = GetLastError();
181189
if ((ret != 0) && ((ret = wchar_to_utf8_no_alloc(wlpBuffer, lpBuffer, nSize)) == 0)) {
182190
err = GetLastError();
183191
ret = 0;
184192
}
193+
// Coverity doesn't realise that we filtered out the FORMAT_MESSAGE_ALLOCATE_BUFFER case
194+
// coverity[leaked_storage]
185195
wfree(lpBuffer);
186196
SetLastError(err);
187197
return ret;

src/parser.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Rufus: The Reliable USB Formatting Utility
33
* Elementary Unicode compliant find/replace parser
4-
* Copyright © 2012-2024 Pete Batard <pete@akeo.ie>
4+
* Copyright © 2012-2025 Pete Batard <pete@akeo.ie>
55
*
66
* This program is free software: you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -55,7 +55,7 @@ static loc_cmd* get_loc_cmd(char c, char* line) {
5555
char *endptr, *expected_endptr, *token;
5656
loc_cmd* lcmd = NULL;
5757

58-
for (j=0; j<ARRAYSIZE(parse_cmd); j++) {
58+
for (j = 0; j<ARRAYSIZE(parse_cmd); j++) {
5959
if (c == parse_cmd[j].c)
6060
break;
6161
}
@@ -133,10 +133,11 @@ static loc_cmd* get_loc_cmd(char c, char* line) {
133133
case 'u': // comma or dot separated list of unsigned integers (to end of line)
134134
// count the number of commas
135135
lcmd->unum_size = 1;
136-
for (l=i; line[l] != 0; l++) {
136+
for (l = i; line[l] != 0; l++) {
137137
if ((line[l] == '.') || (line[l] == ','))
138138
lcmd->unum_size++;
139139
}
140+
free(lcmd->unum);
140141
lcmd->unum = (uint32_t*)malloc(lcmd->unum_size * sizeof(uint32_t));
141142
if (lcmd->unum == NULL) {
142143
luprint("could not allocate memory");

src/rufus.rc

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
3333
IDD_DIALOG DIALOGEX 12, 12, 232, 326
3434
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
3535
EXSTYLE WS_EX_ACCEPTFILES
36-
CAPTION "Rufus 4.7.2219"
36+
CAPTION "Rufus 4.7.2220"
3737
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
3838
BEGIN
3939
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@@ -399,8 +399,8 @@ END
399399
//
400400

401401
VS_VERSION_INFO VERSIONINFO
402-
FILEVERSION 4,7,2219,0
403-
PRODUCTVERSION 4,7,2219,0
402+
FILEVERSION 4,7,2220,0
403+
PRODUCTVERSION 4,7,2220,0
404404
FILEFLAGSMASK 0x3fL
405405
#ifdef _DEBUG
406406
FILEFLAGS 0x1L
@@ -418,13 +418,13 @@ BEGIN
418418
VALUE "Comments", "https://rufus.ie"
419419
VALUE "CompanyName", "Akeo Consulting"
420420
VALUE "FileDescription", "Rufus"
421-
VALUE "FileVersion", "4.7.2219"
421+
VALUE "FileVersion", "4.7.2220"
422422
VALUE "InternalName", "Rufus"
423423
VALUE "LegalCopyright", "� 2011-2025 Pete Batard (GPL v3)"
424424
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
425425
VALUE "OriginalFilename", "rufus-4.7.exe"
426426
VALUE "ProductName", "Rufus"
427-
VALUE "ProductVersion", "4.7.2219"
427+
VALUE "ProductVersion", "4.7.2220"
428428
END
429429
END
430430
BLOCK "VarFileInfo"

0 commit comments

Comments
 (0)