Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable ubsan #3452

Merged
merged 22 commits into from
Mar 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Simplify _Need_MEOW_but_cannot.
StephanTLavavej committed Mar 8, 2023
commit 23f93b0c77d1247bcae6b2dcb1c44dfd1cd22ccf
14 changes: 6 additions & 8 deletions stl/inc/sstream
Original file line number Diff line number Diff line change
@@ -328,10 +328,9 @@ protected:

pos_type seekoff(
off_type _Off, ios_base::seekdir _Way, ios_base::openmode _Mode = ios_base::in | ios_base::out) override {
const bool _Need_read_but_cant = ((_Mode & ios_base::in) == ios_base::in) && ((_Mystate & _Noread) == _Noread);
const bool _Need_write_but_cant =
((_Mode & ios_base::out) == ios_base::out) && ((_Mystate & _Constant) == _Constant);
if (_Need_read_but_cant || _Need_write_but_cant) {
const bool _Need_read_but_cannot = (_Mode & ios_base::in) != 0 && (_Mystate & _Noread) != 0;
const bool _Need_write_but_cannot = (_Mode & ios_base::out) != 0 && (_Mystate & _Constant) != 0;
if (_Need_read_but_cannot || _Need_write_but_cannot) {
return pos_type{off_type{-1}};
}

@@ -395,10 +394,9 @@ protected:
}

pos_type seekpos(pos_type _Pos, ios_base::openmode _Mode = ios_base::in | ios_base::out) override {
const bool _Need_read_but_cant = ((_Mode & ios_base::in) == ios_base::in) && ((_Mystate & _Noread) == _Noread);
const bool _Need_write_but_cant =
((_Mode & ios_base::out) == ios_base::out) && ((_Mystate & _Constant) == _Constant);
if (_Need_read_but_cant || _Need_write_but_cant) {
const bool _Need_read_but_cannot = (_Mode & ios_base::in) != 0 && (_Mystate & _Noread) != 0;
const bool _Need_write_but_cannot = (_Mode & ios_base::out) != 0 && (_Mystate & _Constant) != 0;
if (_Need_read_but_cannot || _Need_write_but_cannot) {
return pos_type{off_type{-1}};
}