[Scummvm-git-logs] scummvm master -> b2b4441cee0e6cf0b5b06bdbfc29ec402dae51e6

sev- sev at scummvm.org
Wed Aug 19 10:31:39 UTC 2020


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
3460ee1132 DIRECTOR: InfoEntry struct needs a copy constructor to avoid a double free
184d54708d DIRECTOR: Assignment operator for InfoEntry struct
b2b4441cee DIRECTOR: Copy constructor for DirectorPlotData


Commit: 3460ee11320c44bb3b99ae0a4bf77d648a572f7d
    https://github.com/scummvm/scummvm/commit/3460ee11320c44bb3b99ae0a4bf77d648a572f7d
Author: Henrik "Henke37" Andersson (henke at henke37.cjb.net)
Date: 2020-08-19T12:31:34+02:00

Commit Message:
DIRECTOR: InfoEntry struct needs a copy constructor to avoid a double free

Changed paths:
    engines/director/movie.h


diff --git a/engines/director/movie.h b/engines/director/movie.h
index 4545923ca3..87b7ace039 100644
--- a/engines/director/movie.h
+++ b/engines/director/movie.h
@@ -49,8 +49,15 @@ struct InfoEntry {
 
 	InfoEntry() { len = 0; data = nullptr; }
 
+	InfoEntry(const InfoEntry &old) {
+		len = old.len;
+		data = (byte *)malloc(len);
+		memcpy(data, old.data, len);
+	}
+
 	~InfoEntry() {
 		free(data);
+		data = nullptr;
 	}
 
 	Common::String readString(bool pascal = true) {


Commit: 184d54708d8bd12cd087c0844b0338d17ba7932d
    https://github.com/scummvm/scummvm/commit/184d54708d8bd12cd087c0844b0338d17ba7932d
Author: Henrik "Henke37" Andersson (henke at henke37.cjb.net)
Date: 2020-08-19T12:31:34+02:00

Commit Message:
DIRECTOR: Assignment operator for InfoEntry struct

Changed paths:
    engines/director/movie.h


diff --git a/engines/director/movie.h b/engines/director/movie.h
index 87b7ace039..ec2d45c797 100644
--- a/engines/director/movie.h
+++ b/engines/director/movie.h
@@ -60,6 +60,14 @@ struct InfoEntry {
 		data = nullptr;
 	}
 
+	InfoEntry &operator=(const InfoEntry &old) {
+		free(data);
+		len = old.len;
+		data = (byte *)malloc(len);
+		memcpy(data, old.data, len);
+		return *this;
+	}
+
 	Common::String readString(bool pascal = true) {
 		Common::String res;
 


Commit: b2b4441cee0e6cf0b5b06bdbfc29ec402dae51e6
    https://github.com/scummvm/scummvm/commit/b2b4441cee0e6cf0b5b06bdbfc29ec402dae51e6
Author: Henrik "Henke37" Andersson (henke at henke37.cjb.net)
Date: 2020-08-19T12:31:34+02:00

Commit Message:
DIRECTOR: Copy constructor for DirectorPlotData

It's another double free causer.

Changed paths:
    engines/director/director.h


diff --git a/engines/director/director.h b/engines/director/director.h
index 397eff8cba..56773ef74f 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -158,6 +158,22 @@ struct DirectorPlotData {
 		applyColor = false;
 	}
 
+	DirectorPlotData(const DirectorPlotData &old) : _wm(old._wm), sprite(old.sprite),
+	                                                ink(old.ink), alpha(old.alpha),
+	                                                backColor(old.backColor), foreColor(old.foreColor),
+	                                                srf(old.srf), dst(old.dst),
+	                                                destRect(old.destRect), srcPoint(old.srcPoint),
+	                                                colorWhite(old.colorWhite), colorBlack(old.colorBlack),
+	                                                applyColor(old.applyColor) {
+		if (old.ms) {
+			ms = new MacShape(*old.ms);
+		} else {
+			ms = nullptr;
+		}
+	}
+
+	DirectorPlotData &operator=(const DirectorPlotData &);
+
 	~DirectorPlotData() {
 		delete ms;
 	}




More information about the Scummvm-git-logs mailing list