瀏覽代碼

Fix possible infinite loop during SVG sanitization

DarthSim 2 年之前
父節點
當前提交
a518b3a4d2
共有 2 個文件被更改,包括 4 次插入0 次删除
  1. 1 0
      CHANGELOG.md
  2. 3 0
      svg/svg.go

+ 1 - 0
CHANGELOG.md

@@ -8,6 +8,7 @@
 
 ### Fix
 - Fix false-positive SVG detections.
+- Fix possible infinite loop during SVG sanitization.
 - (pro) Fix saving of GIF with variable frame delay to MP4.
 
 ## [3.9.0] - 2022-10-19

+ 3 - 0
svg/svg.go

@@ -40,6 +40,9 @@ func Satitize(data *imagedata.ImageData) (*imagedata.ImageData, error) {
 
 		if ignoreTag > 0 {
 			switch tt {
+			case xml.ErrorToken:
+				cancel()
+				return nil, l.Err()
 			case xml.EndTagToken, xml.StartTagCloseVoidToken:
 				ignoreTag--
 			case xml.StartTagToken: