Skip to content

Commit 2d91dc1

Browse files
authored
Merge branch 'master' into verify-custom-table
2 parents 60d6e9e + 817bab9 commit 2d91dc1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

rust/flatbuffers/src/verifier.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ fn trace_elem<T>(res: Result<T>, index: usize, position: usize) -> Result<T> {
275275
}
276276

277277
#[derive(Debug, Clone, PartialEq, Eq)]
278-
pub struct VerifierOptions {
278+
pub struct VerifierOptions<'a> {
279279
/// Maximum depth of nested tables allowed in a valid flatbuffer.
280280
pub max_depth: usize,
281281
/// Maximum number of tables allowed in a valid flatbuffer.
@@ -289,16 +289,20 @@ pub struct VerifierOptions {
289289
// probably want an option to ignore utf8 errors since strings come from c++
290290
// options to error un-recognized enums and unions? possible footgun.
291291
// Ignore nested flatbuffers, etc?
292+
293+
/// The name of the table to use as the root table instead of the schema root.
294+
pub root_table_name: Option<&'a str>,
292295
}
293296

294-
impl Default for VerifierOptions {
297+
impl Default for VerifierOptions<'_> {
295298
fn default() -> Self {
296299
Self {
297300
max_depth: 64,
298301
max_tables: 1_000_000,
299302
// size_ might do something different.
300303
max_apparent_size: 1 << 31,
301304
ignore_missing_null_terminator: false,
305+
root_table_name: None,
302306
}
303307
}
304308
}
@@ -307,7 +311,7 @@ impl Default for VerifierOptions {
307311
#[derive(Debug)]
308312
pub struct Verifier<'opts, 'buf> {
309313
buffer: &'buf [u8],
310-
opts: &'opts VerifierOptions,
314+
opts: &'opts VerifierOptions<'opts>,
311315
depth: usize,
312316
num_tables: usize,
313317
apparent_size: usize,

0 commit comments

Comments
 (0)