Skip to content
Snippets Groups Projects
Commit c06b0a3e authored by Federico Montesino Pouzols's avatar Federico Montesino Pouzols
Browse files

check size from file used to allocate mem, 1075717, re #13951

parent ba671c78
No related merge requests found
......@@ -95,7 +95,17 @@ int ISISRAW2::ioRAW(FILE *file, bool from_file, bool read_data) {
// ISISRAW::ioRAW(file, &u_len, 1, from_file);
if (from_file) {
u_len = add.ad_data - add.ad_user - 2;
if (u_len < 0 || (add.ad_data < add.ad_user + 2)) {
// this will/would be used for memory allocation
g_log.error() << "Error in u_len value read from file, it would be "
<< u_len << "; where it is calculated as "
"u_len = ad_data - ad_user - 2, where ad_data: "
<< add.ad_data << ", ad_user: " << add.ad_user << "\n";
throw std::runtime_error("Inconsistent value for the field u_len found");
}
}
ISISRAW::ioRAW(file, &u_dat, u_len, from_file);
ISISRAW::ioRAW(file, &ver8, 1, from_file);
fgetpos(file, &dhdr_pos);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment