diff --git a/internal/reader/sanitizer/sanitizer.go b/internal/reader/sanitizer/sanitizer.go
index 5c0026f1..69e45b06 100644
--- a/internal/reader/sanitizer/sanitizer.go
+++ b/internal/reader/sanitizer/sanitizer.go
@@ -541,6 +541,9 @@ func isValidDataAttribute(value string) bool {
}
func isPositiveInteger(value string) bool {
+ if value == "" {
+ return false
+ }
if number, err := strconv.Atoi(value); err == nil {
return number > 0
}
diff --git a/internal/reader/sanitizer/sanitizer_test.go b/internal/reader/sanitizer/sanitizer_test.go
index 0628ec9d..9ce692e2 100644
--- a/internal/reader/sanitizer/sanitizer_test.go
+++ b/internal/reader/sanitizer/sanitizer_test.go
@@ -99,6 +99,16 @@ func TestImgWithIncorrectWidthAndHeightAttribute(t *testing.T) {
}
}
+func TestImgWithEmptywidthAndHeightAttribute(t *testing.T) {
+ input := `
`
+ expected := `
`
+ output := SanitizeHTMLWithDefaultOptions("http://example.org/", input)
+
+ if output != expected {
+ t.Errorf(`Wrong output: %s`, output)
+ }
+}
+
func TestImgWithTextDataURL(t *testing.T) {
input := `
`
expected := ``