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

mikrosk noreply at scummvm.org
Tue May 19 11:46:34 UTC 2026


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

Summary:
e729556f30 AUDIO: Don't use static Common::String instance


Commit: e729556f305c7bd6e71d94cd15868a0272de2ef4
    https://github.com/scummvm/scummvm/commit/e729556f305c7bd6e71d94cd15868a0272de2ef4
Author: Miro Kropacek (miro.kropacek at gmail.com)
Date: 2026-05-19T21:46:26+10:00

Commit Message:
AUDIO: Don't use static Common::String instance

This fixes the ASAN issue.

Changed paths:
    audio/rate.cpp


diff --git a/audio/rate.cpp b/audio/rate.cpp
index aa50346b0df..4638f827270 100644
--- a/audio/rate.cpp
+++ b/audio/rate.cpp
@@ -84,18 +84,20 @@ private:
 	int simpleConvert(AudioStream &input, st_sample_t *outBuffer, st_size_t numSamples, st_volume_t vol_l, st_volume_t vol_r);
 	int interpolateConvert(AudioStream &input, st_sample_t *outBuffer, st_size_t numSamples, st_volume_t vol_l, st_volume_t vol_r);
 
-	// keep a single printConvertType shared across all RateConverter_Impl specializations
+	// keep a single printConvertType shared across all RateConverter_Impl specializations.
+	// PrintContext must be trivially destructible: it lives in a function-scope static and
+	// is torn down after the OSystem (and its memory pool that backs Common::String) is gone.
 	struct PrintContext {
 		st_rate_t previousInRate = 0;
-		Common::String previousGameId;
+		char previousGameId[64] = { 0 };
 	};
 	void printConvertType(const char *name, PrintContext &ctx) const {
-		const Common::String activeDomain = ConfMan.getActiveDomainName();
+		const Common::String &activeDomain = ConfMan.getActiveDomainName();
 		if (!activeDomain.empty() &&
 			(ctx.previousInRate != _inRate ||
-			 ctx.previousGameId != activeDomain)) {
+			 strncmp(ctx.previousGameId, activeDomain.c_str(), sizeof(ctx.previousGameId)) != 0)) {
 			ctx.previousInRate = _inRate;
-			ctx.previousGameId = activeDomain;
+			Common::strlcpy(ctx.previousGameId, activeDomain.c_str(), sizeof(ctx.previousGameId));
 			debugC(kDebugLevelGAudio, "RateConverter_Impl::%s[%s]: inRate %d Hz (%s) => outRate %d Hz (%s)",
 				  name, activeDomain.c_str(),
 				  _inRate, inStereo ? "stereo" : "mono", _outRate, outStereo ? "stereo" : "mono");




More information about the Scummvm-git-logs mailing list