fix zero length attachments crashing signal

Fixes #5331
Closes #5926
This commit is contained in:
Benedikt Constantin Radtke 2016-12-05 22:13:33 +01:00 committed by Moxie Marlinspike
parent cde92256a6
commit a6488b3652

View File

@ -63,7 +63,7 @@ public abstract class PushSendJob extends SendJob {
ContentType.isVideoType(attachment.getContentType()))
{
try {
if (attachment.getDataUri() == null) throw new IOException("Assertion failed, outgoing attachment has no data!");
if (attachment.getDataUri() == null || attachment.getSize() == 0) throw new IOException("Assertion failed, outgoing attachment has no data!");
InputStream is = PartAuthority.getAttachmentStream(context, masterSecret, attachment.getDataUri());
attachments.add(SignalServiceAttachment.newStreamBuilder()
.withStream(is)