Skip to content

Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.

C

fix: a reply with an absurd length is refused, and a rule that sets a boolean leaves other values alone

BartolomeoRusso955e63ff7643f
diff --git a/tweak/Sources/Shared/AdBlock/Premium.m b/tweak/Sources/Shared/AdBlock/Premium.m
index e7219292..c55a3b75 100644
--- a/tweak/Sources/Shared/AdBlock/Premium.m
+++ b/tweak/Sources/Shared/AdBlock/Premium.m
@@ -384,6 +384,10 @@ static NSData *patchConfiguration(NSData *configuration) {
switch (rules[i].kind) {
case SGRuleRemove: removed = YES; break;
case SGRuleSet:
+ // Set changes a boolean that is there; a value of another kind (a count of seconds, say)
+ // under the same name is left as the server sent it rather than turned into a false.
+ if (SGPBFirst(value, 3)) setValue(value, SGPBBytes(3, boolValue(rules[i].on)));
+ break;
case SGRuleForce: setValue(value, SGPBBytes(3, boolValue(rules[i].on))); break;
case SGRuleEnum: setValue(value, SGPBBytes(5, SGPBSerialize(@[SGPBString(1, @(rules[i].text))]))); break;
}
diff --git a/tweak/Sources/Shared/AdBlock/Protobuf.m b/tweak/Sources/Shared/AdBlock/Protobuf.m
index 178d4478..92588fa1 100644
--- a/tweak/Sources/Shared/AdBlock/Protobuf.m
+++ b/tweak/Sources/Shared/AdBlock/Protobuf.m
@@ -49,7 +49,8 @@ NSMutableArray<SGPBField *> *SGPBParse(NSData *data) {
at += size;
break;
case 2:
- if (!readVarint(bytes, length, &at, &value) || at + value > length) return nil;
+ // Against what is left rather than at + value, which a length near 2^64 wraps past the check.
+ if (!readVarint(bytes, length, &at, &value) || value > length - at) return nil;
field.payload = [NSData dataWithBytes:bytes + at length:(NSUInteger)value];
at += value;
break;