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

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

parent 99e73977
No related branches found
No related tags found
No related merge requests found
...@@ -460,7 +460,17 @@ int ISISRAW::ioRAW(FILE *file, bool from_file, bool read_data) { ...@@ -460,7 +460,17 @@ int ISISRAW::ioRAW(FILE *file, bool from_file, bool read_data) {
// ioRAW(file, &u_len, 1, from_file); // ioRAW(file, &u_len, 1, from_file);
if (from_file) { if (from_file) {
u_len = add.ad_data - add.ad_user - 2; 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
std::cerr << "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 << std::endl;
return 0;
}
} }
ioRAW(file, &u_dat, u_len, from_file); ioRAW(file, &u_dat, u_len, from_file);
ioRAW(file, &ver8, 1, from_file); ioRAW(file, &ver8, 1, from_file);
fgetpos(file, &dhdr_pos); 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