Skip to content

Commit d251c8e

Browse files
elliotttcfallin
andauthored
Fix bit packing of bundle params (#192)
Fix a fuzzbug introduced in #185 where we missed updating a mask after also updating a constant indicating that the bit was no longer used. This PR fixes the bug by using the appropriate constant when masking, and also removing some additional functions that were missed in #185. co-authored-by: Chris Fallin <[email protected]>
1 parent b778e88 commit d251c8e

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

src/ion/data_structures.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,6 @@ impl LiveBundle {
239239
self.spill_weight_and_props & (1 << 29) != 0
240240
}
241241

242-
#[inline(always)]
243-
pub fn cached_stack(&self) -> bool {
244-
self.spill_weight_and_props & (1 << 28) != 0
245-
}
246-
247242
#[inline(always)]
248243
pub fn set_cached_fixed(&mut self) {
249244
self.spill_weight_and_props |= 1 << 30;
@@ -254,14 +249,9 @@ impl LiveBundle {
254249
self.spill_weight_and_props |= 1 << 29;
255250
}
256251

257-
#[inline(always)]
258-
pub fn set_cached_stack(&mut self) {
259-
self.spill_weight_and_props |= 1 << 28;
260-
}
261-
262252
#[inline(always)]
263253
pub fn cached_spill_weight(&self) -> u32 {
264-
self.spill_weight_and_props & ((1 << 28) - 1)
254+
self.spill_weight_and_props & BUNDLE_MAX_SPILL_WEIGHT
265255
}
266256
}
267257

src/ion/merge.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,7 @@ impl<'a, F: Function> Env<'a, F> {
110110
}
111111

112112
// Check for a requirements conflict.
113-
if self.bundles[from].cached_stack()
114-
|| self.bundles[from].cached_fixed()
115-
|| self.bundles[to].cached_stack()
116-
|| self.bundles[to].cached_fixed()
117-
{
113+
if self.bundles[from].cached_fixed() || self.bundles[to].cached_fixed() {
118114
if self.merge_bundle_requirements(from, to).is_err() {
119115
trace!(" -> conflicting requirements; aborting merge");
120116
return false;
@@ -155,9 +151,6 @@ impl<'a, F: Function> Env<'a, F> {
155151
}
156152
self.bundles[to].ranges = list;
157153

158-
if self.bundles[from].cached_stack() {
159-
self.bundles[to].set_cached_stack();
160-
}
161154
if self.bundles[from].cached_fixed() {
162155
self.bundles[to].set_cached_fixed();
163156
}
@@ -224,9 +217,6 @@ impl<'a, F: Function> Env<'a, F> {
224217
*to_range = to_range.join(from_range);
225218
}
226219

227-
if self.bundles[from].cached_stack() {
228-
self.bundles[to].set_cached_stack();
229-
}
230220
if self.bundles[from].cached_fixed() {
231221
self.bundles[to].set_cached_fixed();
232222
}

0 commit comments

Comments
 (0)