Skip to content

Commit f6206b0

Browse files
committed
Guard against integer overflow in release mode
1 parent 1c63dc7 commit f6206b0

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

  • time-macros/src/format_description
  • time/src/format_description/parse

time-macros/src/format_description/lexer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub(super) fn lex<const VERSION: u8>(
128128
) -> Lexed<impl Iterator<Item = Result<Token<'_>, Error>>> {
129129
assert!(version!(1..=2));
130130

131-
let mut depth: u8 = 0;
131+
let mut depth: u32 = 0;
132132
let mut iter = attach_location(input.iter(), proc_span).peekable();
133133
let mut second_bracket_location = None;
134134

time/src/format_description/parse/lexer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ pub(super) fn lex<const VERSION: usize>(
159159
) -> Lexed<impl Iterator<Item = Result<Token<'_>, Error>>> {
160160
validate_version!(VERSION);
161161

162-
let mut depth: u8 = 0;
162+
let mut depth: u32 = 0;
163163
let mut iter = attach_location(input.iter()).peekable();
164164
let mut second_bracket_location = None;
165165

0 commit comments

Comments
 (0)