Skip to content

Commit c2c80d8

Browse files
committed
cctz: time_zone_fixed: throw rather than assert
1 parent 79c15a0 commit c2c80d8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cctz/src/time_zone_fixed.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,11 @@ std::string FixedOffsetToName(const seconds& offset) {
125125
ep = Format02d(ep, offset_seconds, false);
126126
}
127127
*ep++ = '\0';
128-
// package:odbc: Less strict assert
129-
assert(ep - buf <= (long int)sizeof(buf));
128+
// package:odbc: Less strict
129+
// package:odbc: throw rather than assert
130+
if (ep - buf > (long int)sizeof(buf)) {
131+
throw std::runtime_error("Unexpected buffer overflow");
132+
}
130133
return buf;
131134
}
132135

0 commit comments

Comments
 (0)