You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
throwstd::range_error("Section pos too big. There are " + std::to_string(sections[sectionId].size()) + " and it's trying to access section: " + std::to_string(sectionPos));
136
91
}
137
92
138
-
if (readingSection != NULL) {
93
+
if (readingSection != nullptr) {
139
94
throwstd::range_error("Already reading a section");
thrownewstd::range_error("Section does not exist: " + std::to_string(sectionId));
127
+
throwstd::range_error("Section does not exist: " + std::to_string(sectionId));
173
128
}
174
129
175
130
if (sectionPos >= sections[sectionId].size()) {
176
-
thrownewstd::range_error("Section pos too big. There are " + std::to_string(sections[sectionId].size()) + " and it's trying to access section: " + std::to_string(sectionPos));
131
+
throwstd::range_error("Section pos too big. There are " + std::to_string(sections[sectionId].size()) + " and it's trying to access section: " + std::to_string(sectionPos));
177
132
}
178
133
179
134
return sections[sectionId][sectionPos].size;
180
135
}
181
136
182
137
u_int32_tBinFile::readU32LE() {
138
+
constu_int64_t new_pos = pos + 4;
139
+
140
+
if (new_pos > size) {
141
+
throwstd::range_error("File pos is too big. There are " + std::to_string(size) + " bytes and it's trying to access byte " + std::to_string(new_pos));
142
+
}
143
+
183
144
u_int32_t res = *((u_int32_t *)((u_int64_t)addr + pos));
184
-
pos += 4;
145
+
pos = new_pos;
185
146
return res;
186
147
}
187
148
188
149
u_int64_tBinFile::readU64LE() {
150
+
constu_int64_t new_pos = pos + 8;
151
+
152
+
if (new_pos > size) {
153
+
throwstd::range_error("File pos is too big. There are " + std::to_string(size) + " bytes and it's trying to access byte " + std::to_string(new_pos));
154
+
}
155
+
189
156
u_int64_t res = *((u_int64_t *)((u_int64_t)addr + pos));
190
-
pos += 8;
157
+
pos = new_pos;
191
158
return res;
192
159
}
193
160
194
161
void *BinFile::read(u_int64_t len) {
162
+
constu_int64_t new_pos = pos + len;
163
+
164
+
if (new_pos > size) {
165
+
throwstd::range_error("File pos is too big. There are " + std::to_string(size) + " bytes and it's trying to access byte " + std::to_string(new_pos));
0 commit comments