Unverified Commit a43309ca authored by narugo1992's avatar narugo1992 Committed by GitHub
Browse files

Merge pull request #101 from deepghs/fix/nai

dev(narugo): try fix unlimited loop
parents c734909c 52c74b55
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -73,6 +73,8 @@ class LSBExtractor(object):
            if self.row == self.rows:
                self.row = 0
                self.col += 1
        else:
            raise IOError('Cannot read more bits.')

    def get_one_byte(self):
        """
+2 −1
Original line number Diff line number Diff line
@@ -96,10 +96,11 @@ def _get_naimeta_raw(image: ImageTyping) -> dict:
    image = load_image(image, force_background=None, mode=None)
    try:
        return ImageLsbDataExtractor().extract_data(image)
    except (ValueError, json.JSONDecodeError, zlib.error, OSError, UnicodeDecodeError):
    except (ValueError, json.JSONDecodeError, zlib.error, OSError, IOError, UnicodeDecodeError):
        # ValueError: binary data with wrong format
        # json.JSONDecodeError: zot a json-formatted data
        # zlib.error, OSError: not zlib compressed binary data
        # IOError: unable to read more from images
        # UnicodeDecodeError: cannot decode as utf-8 text
        return image.info or {}