diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-01-15 08:57:26 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-01-18 02:54:07 +0300 |
commit | e6df02861e17f75d4dd243776f35208681b78465 (patch) | |
tree | b4ebbb1f9752f3cab8ada017f40d91172971915a /source/blender/blenloader/intern | |
parent | e04d7c49dca9dc7bbf1cbe446b612aaa5ba12581 (diff) |
Fix buffer overflow vulnerability in curve, font, particles code.
Solves these security issues from T52924:
CVE-2017-12102
CVE-2017-12103
CVE-2017-12104
While the specific overflow issue may be fixed, loading the repro .blend
files may still crash because they are incomplete and corrupt. The way
they crash may be impossible to exploit, but this is difficult to prove.
Differential Revision: https://developer.blender.org/D3002
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 8edaf071f36..39f83062401 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3859,6 +3859,9 @@ static void direct_link_curve(FileData *fd, Curve *cu) cu->adt= newdataadr(fd, cu->adt); direct_link_animdata(fd, cu->adt); + /* Protect against integer overflow vulnerability. */ + CLAMP(cu->len_wchar, 0, INT_MAX - 4); + cu->mat = newdataadr(fd, cu->mat); test_pointer_array(fd, (void **)&cu->mat); cu->str = newdataadr(fd, cu->str); @@ -4273,6 +4276,9 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) for (a = 0; a < MAX_MTEX; a++) { part->mtex[a] = newdataadr(fd, part->mtex[a]); } + + /* Protect against integer overflow vulnerability. */ + CLAMP(part->trail_count, 1, 100000); } static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase *particles) @@ -8193,7 +8199,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short id = read_struct(fd, bhead, "lib block"); if (id) { - const short idcode = (bhead->code == ID_ID) ? GS(id->name) : bhead->code; + const short idcode = GS(id->name); /* do after read_struct, for dna reconstruct */ lb = which_libbase(main, idcode); if (lb) { |