Skip to content

Commit

Permalink
Fix some shift-sign-overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
r-barnes committed Feb 29, 2024
1 parent b311b11 commit 3cf89bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions libredex/DexOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ class DexOutput {
enhanced_dex_stats_t m_stats;

static constexpr size_t kIODILayerBits = 4;
static constexpr size_t kIODILayerBound = 1 << (kIODILayerBits - 1);
static constexpr size_t kIODILayerBound = 1ul << (kIODILayerBits - 1);
static constexpr size_t kIODILayerShift =
sizeof(uint32_t) * 8 - kIODILayerBits;
static constexpr uint32_t kIODIDataMask = (1 << kIODILayerShift) - 1;
static constexpr uint32_t kIODILayerMask = ((1 << kIODILayerBits) - 1)
static constexpr uint32_t kIODIDataMask = (1u << kIODILayerShift) - 1;
static constexpr uint32_t kIODILayerMask = ((1u << kIODILayerBits) - 1)
<< kIODILayerShift;

private:
Expand Down
2 changes: 1 addition & 1 deletion libresource/androidfw/ResourceTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ struct Res_value
// Where the actual value is. This gives us 23 bits of
// precision. The top bit is the sign.
COMPLEX_MANTISSA_SHIFT = 8,
COMPLEX_MANTISSA_MASK = 0xffffff
COMPLEX_MANTISSA_MASK = 0xffffffU
};

// Possible data values for TYPE_NULL.
Expand Down

0 comments on commit 3cf89bd

Please sign in to comment.