[Scummvm-git-logs] scummvm master -> 0a34c124e76fd1e2a378970922f8ca2cb2f3d9ff

digitall noreply at scummvm.org
Mon Jan 3 20:32:29 UTC 2022


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

Summary:
0a34c124e7 SCI: Correct Resource Patcher for New Resource Patches


Commit: 0a34c124e76fd1e2a378970922f8ca2cb2f3d9ff
    https://github.com/scummvm/scummvm/commit/0a34c124e76fd1e2a378970922f8ca2cb2f3d9ff
Author: D G Turner (digitall at scummvm.org)
Date: 2022-01-03T20:26:59Z

Commit Message:
SCI: Correct Resource Patcher for New Resource Patches

This should properly fix bug #13192 (SCI: Police Quest 4 - Random Crashes)

The view.10988 resource is a new resource as per the patch table. These
type of new resource will have a nullptr for the source when being patched.

This meant that the final memcpy to copy the remaining source would be
called with a nullptr in these cases. To avoid this, have added a nullptr
check on the source to this which should avoid this in future.

This only affected PQ4 as this was the only resource patch which created
a new resource.

Changed paths:
    engines/sci/resource/resource_patcher.cpp


diff --git a/engines/sci/resource/resource_patcher.cpp b/engines/sci/resource/resource_patcher.cpp
index 5c370c702ec..3b4461df9c7 100644
--- a/engines/sci/resource/resource_patcher.cpp
+++ b/engines/sci/resource/resource_patcher.cpp
@@ -549,11 +549,6 @@ void ResourcePatcher::scanSource(ResourceManager *resMan) {
 void ResourcePatcher::patchResource(Resource &resource, const GameResourcePatch &patch) const {
 	const byte *oldData;
 	const byte *source = resource.data();
-	if (!source) {
-		ResourceId resourceId(patch.resourceType, patch.resourceNumber);
-		warning("Unable to apply patch %s: source data is null", resourceId.toString().c_str());
-		return;
-	}
 	byte *target;
 
 	// New resources that came from ResourcePatcher need to get allocated or
@@ -671,7 +666,7 @@ void ResourcePatcher::patchResource(Resource &resource, const GameResourcePatch
 		}
 	}
 
-	if (target != source) {
+	if (source && target != source) {
 		memcpy(target, source, resource._size - (target - resource._data));
 	}
 




More information about the Scummvm-git-logs mailing list