mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-09 04:21:56 -04:00
[core] fix size check for VHD images
* Recent changes broke the check for whether the source image is larger than the target drive in the case of uncompressed VHDs (that have a 512 byte footer), so fix that by making sure we always compare with the projected size. * Closes #2729. * Also fix some more Coverity warnings.
This commit is contained in:
parent
965759f58a
commit
13c6becf42
5 changed files with 18 additions and 8 deletions
|
@ -1451,7 +1451,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
|
|||
if (boot_type == BT_IMAGE) {
|
||||
if_not_assert(image_path != NULL)
|
||||
goto out;
|
||||
if ((size_check) && (MAX(img_report.image_size, img_report.projected_size) > (uint64_t)SelectedDrive.DiskSize)) {
|
||||
if ((size_check) && (img_report.projected_size > (uint64_t)SelectedDrive.DiskSize)) {
|
||||
// This ISO image is too big for the selected target
|
||||
MessageBoxExU(hMainDialog, lmprintf(MSG_089), lmprintf(MSG_088), MB_OK | MB_ICONERROR | MB_IS_RTL, selected_langid);
|
||||
goto out;
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "Rufus 4.8.2242"
|
||||
CAPTION "Rufus 4.8.2243"
|
||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||
|
@ -407,8 +407,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 4,8,2242,0
|
||||
PRODUCTVERSION 4,8,2242,0
|
||||
FILEVERSION 4,8,2243,0
|
||||
PRODUCTVERSION 4,8,2243,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -426,13 +426,13 @@ BEGIN
|
|||
VALUE "Comments", "https://rufus.ie"
|
||||
VALUE "CompanyName", "Akeo Consulting"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "4.8.2242"
|
||||
VALUE "FileVersion", "4.8.2243"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2025 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||
VALUE "OriginalFilename", "rufus-4.8.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "4.8.2242"
|
||||
VALUE "ProductVersion", "4.8.2243"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -186,6 +186,8 @@ int8_t IsBootableImage(const char* path)
|
|||
goto out;
|
||||
}
|
||||
img_report.image_size = (uint64_t)liImageSize.QuadPart;
|
||||
if (img_report.projected_size == 0)
|
||||
img_report.projected_size = img_report.image_size;
|
||||
size = sizeof(wim_magic);
|
||||
IGNORE_RETVAL(SetFilePointerEx(handle, ptr, NULL, FILE_BEGIN));
|
||||
img_report.is_windows_img = ReadFile(handle, &wim_magic, size, &size, NULL) && (wim_magic == WIM_MAGIC);
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
* optimizations.
|
||||
*/
|
||||
|
||||
#include "wimlib/assert.h"
|
||||
#include "wimlib/bitops.h"
|
||||
#include "wimlib/compress_common.h"
|
||||
#include "wimlib/compressor_ops.h"
|
||||
|
@ -504,6 +505,8 @@ xpress_record_match(struct xpress_compressor *c, unsigned length, unsigned offse
|
|||
unsigned log2_offset = bsr32(offset);
|
||||
unsigned sym = XPRESS_NUM_CHARS + ((log2_offset << 4) | len_hdr);
|
||||
|
||||
wimlib_assert(sym < XPRESS_NUM_SYMBOLS);
|
||||
// coverity[overrun-local]
|
||||
c->freqs[sym]++;
|
||||
|
||||
return (struct xpress_item) {
|
||||
|
@ -759,6 +762,8 @@ xpress_tally_item_list(struct xpress_compressor *c,
|
|||
len_hdr = min(0xF, adjusted_len);
|
||||
sym = XPRESS_NUM_CHARS + ((log2_offset << 4) | len_hdr);
|
||||
|
||||
wimlib_assert(sym < XPRESS_NUM_SYMBOLS);
|
||||
// coverity[overrun-local]
|
||||
c->freqs[sym]++;
|
||||
}
|
||||
cur_node += length;
|
||||
|
@ -872,6 +877,8 @@ xpress_find_min_cost_path(struct xpress_compressor *c, size_t in_nbytes,
|
|||
len_hdr = min(adjusted_len, 0xF);
|
||||
sym = XPRESS_NUM_CHARS +
|
||||
((log2_offset << 4) | len_hdr);
|
||||
wimlib_assert(sym < XPRESS_NUM_SYMBOLS);
|
||||
// coverity[overrun-local]
|
||||
cost_to_end =
|
||||
offset_cost + c->costs[sym] +
|
||||
(cur_node + len)->cost_to_end;
|
||||
|
|
|
@ -240,6 +240,7 @@ char *ezxml_decode(char *s, char **ent, char t)
|
|||
l = (d = (long)(s - r)) + c + (long)(e ? strlen(e) : 0); // new length
|
||||
r = (r == m) ? strcpy(malloc(l), r) : _realloc(r, l);
|
||||
e = strchr((s = r + d), ';'); // fix up pointers
|
||||
if (!e) return r;
|
||||
}
|
||||
|
||||
memmove(s + c, e + 1, strlen(e)); // shift rest of string
|
||||
|
@ -680,7 +681,7 @@ ezxml_t ezxml_parse_fd(int fd)
|
|||
{
|
||||
ezxml_root_t root;
|
||||
struct stat st;
|
||||
size_t l;
|
||||
ssize_t l;
|
||||
void *m;
|
||||
|
||||
if (fd < 0 || fstat(fd, &st)) return NULL;
|
||||
|
@ -696,7 +697,7 @@ ezxml_t ezxml_parse_fd(int fd)
|
|||
}
|
||||
else { // mmap failed, read file into memory
|
||||
#endif // EZXML_NOMMAP
|
||||
l = (long)_read(fd, m = malloc((size_t)st.st_size), (unsigned int)st.st_size);
|
||||
l = (ssize_t)_read(fd, m = malloc((size_t)st.st_size), (unsigned int)st.st_size);
|
||||
if (l < 0) { free(m); return NULL; };
|
||||
root = (ezxml_root_t)ezxml_parse_str(m, l);
|
||||
if (!root) { free(m); return NULL; };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue