mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-05 22:16:10 +08:00
Merge pull request #3809 from lordofhyphens/fix-3238-garbage-stl
Abort loading if the file size is larger than the header facets
This commit is contained in:
commit
9ecc1a2603
@ -131,6 +131,12 @@ stl_count_facets(stl_file *stl, const char *file) {
|
||||
if((!fread(&header_num_facets, sizeof(int), 1, stl->fp)) || (num_facets != header_num_facets)) {
|
||||
fprintf(stderr,
|
||||
"Warning: File size doesn't match number of facets in the header\n");
|
||||
|
||||
if(num_facets > header_num_facets) {
|
||||
// this file is garbage.
|
||||
stl->error = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Otherwise, if the .STL file is ASCII, then do the following */
|
||||
|
Loading…
x
Reference in New Issue
Block a user