Skip to content

Commit 8b5a462

Browse files
committed
feat: error instead of panic on too many buffers
Currently this panics in `write_flatbuffer`. Panics print a double stack trace and are a bit weird when they happen in a future. Signed-off-by: Daniel King <[email protected]>
1 parent fdb7d2f commit 8b5a462

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

vortex-array/src/serde.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ impl<'a> ArrayNodeFlatBuffer<'a> {
155155
);
156156
}
157157
}
158+
let n_buffers_recursive = array.nbuffers_recursive();
159+
if u16::try_from(n_buffers_recursive).is_err() {
160+
vortex_bail!(
161+
"Array and all descendent arrays can have at most u16::MAX buffers: {}",
162+
n_buffers_recursive
163+
);
164+
};
158165
Ok(Self {
159166
ctx,
160167
array,

0 commit comments

Comments
 (0)