Fix failing AttachmentCipherTest for incremental mac.

This commit is contained in:
Clark 2023-07-11 17:48:14 -04:00 committed by Clark Chen
parent 648506fe04
commit 8fc03a67b9
3 changed files with 2 additions and 8 deletions

View file

@ -179,11 +179,8 @@ public class SignalServiceMessageReceiver {
byte[] manifestBytes = socket.retrieveStickerManifest(packId);
InputStream cipherStream = AttachmentCipherInputStream.createForStickerData(manifestBytes, packKey);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Util.copy(cipherStream, outputStream);
StickerProtos.Pack pack = StickerProtos.Pack.parseFrom(outputStream.toByteArray());
StickerProtos.Pack pack = StickerProtos.Pack.parseFrom(Util.readFullyAsBytes(cipherStream));
List<SignalServiceStickerManifest.StickerInfo> stickers = new ArrayList<>(pack.getStickersCount());
SignalServiceStickerManifest.StickerInfo cover = pack.hasCover() ? new SignalServiceStickerManifest.StickerInfo(pack.getCover().getId(), pack.getCover().getEmoji(), pack.getCover().getContentType())
: null;

View file

@ -120,7 +120,6 @@ public class Util {
}
in.close();
out.close();
}
public static void sleep(long millis) {

View file

@ -333,9 +333,7 @@ public final class AttachmentCipherTest {
}
private static byte[] readInputStreamFully(InputStream inputStream) throws IOException {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Util.copy(inputStream, outputStream);
return outputStream.toByteArray();
return Util.readFullyAsBytes(inputStream);
}
private static byte[] expandPackKey(byte[] shortKey) {