Differences From Artifact [0463ac5206]:
- File src/OFZIPArchive.m — part of check-in [6b42e44f99] at 2018-06-10 20:29:27 on branch trunk — OF{LHA,ZIP}Archive: Improve truncation detection (user: js, size: 23283) [annotate] [blame] [check-ins using]
To Artifact [9e27ae6fff]:
- File
src/OFZIPArchive.m
— part of check-in
[8f21e8acb5]
at
2018-06-12 21:33:18
on branch trunk
— Rename OFChecksum{Failed -> Mismatch}Exception
This also adds a parameter for the actual and expected checksum. (user: js, size: 23570) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
31 32 33 34 35 36 37 | # import "OFFile.h" #endif #import "OFInflateStream.h" #import "OFInflate64Stream.h" #import "crc32.h" | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # import "OFFile.h" #endif #import "OFInflateStream.h" #import "OFInflate64Stream.h" #import "crc32.h" #import "OFChecksumMismatchException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFNotOpenException.h" #import "OFOpenItemFailedException.h" #import "OFOutOfRangeException.h" #import "OFSeekFailedException.h" |
︙ | ︙ | |||
814 815 816 817 818 819 820 | _toRead -= ret; _CRC32 = of_crc32(_CRC32, buffer, ret); if (_toRead == 0) { _atEndOfStream = true; | | > > > > > | > > > | 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 | _toRead -= ret; _CRC32 = of_crc32(_CRC32, buffer, ret); if (_toRead == 0) { _atEndOfStream = true; if (~_CRC32 != [_entry CRC32]) { OFString *actualChecksum = [OFString stringWithFormat: @"%08" PRIX32, ~_CRC32]; OFString *expectedChecksum = [OFString stringWithFormat: @"%08" PRIX32, [_entry CRC32]]; @throw [OFChecksumMismatchException exceptionWithActualChecksum: actualChecksum expectedChecksum: expectedChecksum]; } } return ret; } - (bool)hasDataInReadBuffer { |
︙ | ︙ |