1

Apple 對 PNG 解碼的 bug

 2 years ago
source link: https://blog.gslin.org/archives/2021/12/22/10470/apple-%e5%b0%8d-png-%e8%a7%a3%e7%a2%bc%e7%9a%84-bug/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Apple 對 PNG 解碼的 bug

前幾天的 Hacker News Daily 上看到「PNG Parser Differential」這個,對應的討論在「PNG Parser Differential (vidbuchanan.co.uk)」這邊可以看到。

作者想要利用 threading 加速處理 PNG 格式,結果寫出了 bug,但意外發現 Apple 的 PNG decoder 也犯了一樣的問題:「Ambiguous Decodes #3」。

作者做了一個特別的 PNG 放在網站上,在非 Safari 的情況下會是:

而拿 iPhone 的 Safari 讀的話,可以看到:

應該是 implementation bug,還蠻有趣的 bug...

Related

PNG 現況整理...

「Does PNG work everywhere?」這篇文章把 PNG 的現況整理成表格,並且附上不少圖片範例可以看。表格包括在處理圖片常用的 Photoshop 軟體,以及常見的問題瀏覽器 IE 各版本。 如果不牽扯到 Gamma correction 與 ICC profile,Mozilla Firefox、Safari (包括行動版本) 以及 Opera 對於不同格式的 PNG 都沒有什麼問題... 就這部份的結論是,IE6 只能用最基本的 PNG 格式,但如果同意讓 IE6 看到比較差的效果 (不是看不到),不少格式可以用。 另外作者也不斷地再推廣使用 PNG 最佳化程式處理 PNG 檔,以節省空間。文章後面的 Troubleshooting 以及 Summary 章節很值得仔細看過一次,在腦袋裡面留下印象...

December 18, 2010

In "Browser"

WebP 的檔案大小未必比 JPEG 小...

在「Is WebP really better than JPEG?」這邊發現在差不多的條件需求下,WebP 壓出來的檔案大小未必會比 JPEG 小。 先講結論:提供服務的人可以先確認自家的 JPEG 壓縮是不是有先用 MozJPEG (壓縮率更好),然後再考慮要不要支援 WebP。 Google 在推 WebP 這個格式的時候,宣稱失真壓縮的部份可以比 JPEG 小 25%~34%:(出自「A new image format for the Web」) WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller than comparable JPEG images at…

June 25, 2020

In "Browser"

把 Blog 上的 PNG 圖片換成 WebP 格式

WebP 格式的大小比起 JPEG 或是 PNG 都小不少,支援度也都還行,但 Safari 不支援是個大問題,因為在行動裝置裡面 iOS 還是大宗... 目前想到的方法是只對 Imgur 的圖片使用 WebP (.webp),當遇到不支援的 WebP 的平台時透過 JavaScript 改用 PNG (.png)。 這邊有判斷有沒有支援 WebP 的程式碼出自「Detect WEBP Support with JavaScript」,用 createImageBitmap() 建看看有沒有成功: (() => { let supportsWebP = async () => { if (!self.createImageBitmap) return false; const webpData = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA='; const blob…

May 8, 2019

In "Blog"

a611ee8db44c8d03a20edf0bf5a71d80?s=49&d=identicon&r=gAuthor Gea-Suan LinPosted on December 22, 2021Categories Computer, Library, Murmuring, OS, Photo, Recreation, SoftwareTags apple, bug, decoder, implementation, png, safari

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comment

Name *

Email *

Website

Notify me of follow-up comments by email.

Notify me of new posts by email.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Learn More)

Post navigation


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK