Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### 2.15 (unreleased)

- fixed Cygwin compilation by not passing ELF-specific linker flags
- fixed undefined behavior in little-endian field parsing
- fixed MSI MsiDigitalSignatureEx digest ordering during signing and verification
- fixed verification to report failure when timestamp verification fails
- fixed replacing a script signature block that starts the file or follows a
Expand Down
15 changes: 8 additions & 7 deletions appx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2841,7 +2841,8 @@ static uint32_t fileGetU32(FILE *file)
if (size != 4) {
return 0; /* FAILED */
}
return (uint32_t)(b[3] << 24 | b[2] << 16 | b[1] << 8 | b[0]);
return ((uint32_t)b[3] << 24) | ((uint32_t)b[2] << 16) |
((uint32_t)b[1] << 8) | (uint32_t)b[0];
}

/* coverity[ -tainted_data_return ] */
Expand All @@ -2852,7 +2853,7 @@ static uint16_t fileGetU16(FILE *file)
if (size != 2) {
return 0; /* FAILED */
}
return (uint16_t)(b[1] << 8 | b[0]);
return (uint16_t)((uint32_t)b[1] << 8 | b[0]);
}

static uint64_t bufferGetU64(uint8_t *buffer, uint64_t *pos)
Expand All @@ -2864,17 +2865,17 @@ static uint64_t bufferGetU64(uint8_t *buffer, uint64_t *pos)

static uint32_t bufferGetU32(uint8_t *buffer, uint64_t *pos)
{
uint32_t ret = (uint32_t)(buffer[*pos + 3] << 24 | \
buffer[*pos + 2] << 16 | \
buffer[*pos + 1] << 8 | \
buffer[*pos]);
uint32_t ret = ((uint32_t)buffer[*pos + 3] << 24) | \
((uint32_t)buffer[*pos + 2] << 16) | \
((uint32_t)buffer[*pos + 1] << 8) | \
(uint32_t)buffer[*pos];
*pos += 4;
return ret;
}

static uint16_t bufferGetU16(uint8_t *buffer, uint64_t *pos)
{
uint16_t ret = (uint16_t)(buffer[*pos + 1] << 8 | buffer[*pos]);
uint16_t ret = (uint16_t)((uint32_t)buffer[*pos + 1] << 8 | buffer[*pos]);
*pos += 2;
return ret;
}
Expand Down
12 changes: 6 additions & 6 deletions osslsigncode.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@

#define GET_UINT8_LE(p) ((const u_char *)(p))[0]

#define GET_UINT16_LE(p) (uint16_t)(((const u_char *)(p))[0] | \
(((const u_char *)(p))[1] << 8))
#define GET_UINT16_LE(p) (uint16_t)((uint32_t)((const u_char *)(p))[0] | \
((uint32_t)((const u_char *)(p))[1] << 8))

#define GET_UINT32_LE(p) (uint32_t)(((const u_char *)(p))[0] | \
(((const u_char *)(p))[1] << 8) | \
(((const u_char *)(p))[2] << 16) | \
(((const u_char *)(p))[3] << 24))
#define GET_UINT32_LE(p) (uint32_t)((uint32_t)((const u_char *)(p))[0] | \
((uint32_t)((const u_char *)(p))[1] << 8) | \
((uint32_t)((const u_char *)(p))[2] << 16) | \
((uint32_t)((const u_char *)(p))[3] << 24))

#define PUT_UINT8_LE(i, p) ((u_char *)(p))[0] = (u_char)((i) & 0xff);

Expand Down
Loading