             }
         }
 
-        self.fileComment = String(data: Data(bytes: pointerData.alignedBytes(count: fileCommentLength)),
-                                 encoding: .utf8)
+        guard let fileComment = String(data: Data(bytes: pointerData.alignedBytes(count: fileNameLength)),
+                                    encoding: .utf8)
+            else { throw ZipError.wrongTextField }
+        self.fileComment = fileComment
 
         // Let's check entry's values for consistency.
         guard self.versionNeeded <= 45

    private(set) var compSize: UInt64
    private(set) var uncompSize: UInt64

    let fileName: String?

    init(_ pointerData: inout DataWithPointer) throws {
        // Check signature.

    private(set) var compSize: UInt64
    private(set) var uncompSize: UInt64

    let fileName: String
    let fileComment: String?

    private(set) var diskNumberStart: UInt32
