Repository: python-pillow/Pillow

Issue:
Error opening png file
### What did you do?
I tried to open image

### What did you expect to happen?
Image to be opened without errors

### What actually happened?
Pillow raised error.
Traceback:
```
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 915, in convert
    self.load()
  File "/usr/local/lib/python3.6/dist-packages/PIL/ImageFile.py", line 252, in load
    self.load_end()
  File "/usr/local/lib/python3.6/dist-packages/PIL/PngImagePlugin.py", line 680, in load_end
    self.png.call(cid, pos, length)
  File "/usr/local/lib/python3.6/dist-packages/PIL/PngImagePlugin.py", line 140, in call
    return getattr(self, "chunk_" + cid.decode('ascii'))(pos, length)
AttributeError: 'PngStream' object has no attribute 'chunk_eXIf
```

## What are your OS, Python and Pillow versions?

* OS: Ubuntu 18.04.1 LTS x86_64
* Python: 3.6
* Pillow: 5.4.1

## Demonstration code
```python
from PIL import Image


img = Image.open('50767927-ad61c580-128f-11e9-879e-502cf52fc129.png')
img.load()
```

![Image causing troubles](https://user-images.githubusercontent.com/22667809/50767927-ad61c580-128f-11e9-879e-502cf52fc129.png)

edit: Pillow version I use is 5.4.1, not 3.4.1


Discussion:
With:
* macOS High Sierra
* Python 3.7.2

Cannot reproduce with:
* Pillow 3.4.1
* Pillow 5.3.0

Can reproduce with:
* Pillow 5.4.0
* Pillow 5.4.1 (latest)

Git bisect points to 22837c37e279a5fb3fb7b482d81e2c4d44c8cdcc from https://github.com/python-pillow/Pillow/pull/3506:
```
22837c37e279a5fb3fb7b482d81e2c4d44c8cdcc is the first bad commit
commit 22837c37e279a5fb3fb7b482d81e2c4d44c8cdcc
Date:   Mon Dec 24 23:58:19 2018 +1100

    Read textual chunks located after IDAT chunks

:040000 040000 bbc4e38e995ac826609218792b542d89d25ea138 efdb2cef1a1a438728c23dd94d162d23a8579df7 M	Tests
:040000 040000 5f47d2133fdfa73a7753f08203eb79d1d820a4e4 e38923295adea6da49623e6775bc95dfe483952c M	src
```

Resolving patch:
diff --git a/src/PIL/PngImagePlugin.py b/src/PIL/PngImagePlugin.py
--- a/src/PIL/PngImagePlugin.py
+++ b/src/PIL/PngImagePlugin.py
@@ -533,14 +533,6 @@ def chunk_acTL(self, pos, length):
         self.im_custom_mimetype = 'image/apng'
         return s
 
-    def chunk_fcTL(self, pos, length):
-        s = ImageFile._safe_read(self.fp, length)
-        return s
-
-    def chunk_fdAT(self, pos, length):
-        s = ImageFile._safe_read(self.fp, length)
-        return s
-
 
 # --------------------------------------------------------------------
 # PNG reader
@@ -682,6 +674,9 @@ def load_end(self):
                 break
             except EOFError:
                 ImageFile._safe_read(self.fp, length)
+            except AttributeError:
+                logger.debug("%r %s %s (unknown)", cid, pos, length)
+                ImageFile._safe_read(self.fp, length)
         self._text = self.png.im_text
         self.png.close()
         self.png = None


Test patch:
diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py
--- a/Tests/test_file_png.py
+++ b/Tests/test_file_png.py
@@ -596,6 +596,7 @@ def test_apng(self):
         im = Image.open("Tests/images/iss634.apng")
         self.assertEqual(im.get_format_mimetype(), 'image/apng')
 
+        # This also tests reading unknown PNG chunks (fcTL and fdAT) in load_end
         expected = Image.open("Tests/images/iss634.webp")
         self.assert_image_similar(im, expected, 0.23)