We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb141c5 commit f474dccCopy full SHA for f474dcc
ario/ario.hpp
@@ -94,12 +94,17 @@ class ario
94
std::string data( size, '\0' );
95
std::streamoff current_pos = pstream->tellg();
96
pstream->seekg( filepos + HEADER_SIZE, std::ios::beg );
97
+ if ( pstream->fail() ) {
98
+ return { "Failed to seek to member data position" };
99
+ }
100
pstream->read( &data[0], size );
101
+ if ( pstream->fail() || (size_t)pstream->gcount() < size ) {
102
+ return { "Failed to read member data" };
103
104
+
105
+ // Reset the stream position
106
pstream->clear();
107
pstream->seekg( current_pos, std::ios::beg );
- if ( (size_t)pstream->gcount() < size ) {
- return { "Member data read error" };
- }
108
109
return data;
110
}
0 commit comments