Blame SOURCES/qt-fix-buffer-overflow-in-xbm-parser.patch

9db9f7
diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp
9db9f7
index 414e8233..2824480b 100644
9db9f7
--- a/src/gui/image/qxbmhandler.cpp
9db9f7
+++ b/src/gui/image/qxbmhandler.cpp
9db9f7
@@ -154,7 +154,9 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage)
9db9f7
     w = (w+7)/8;                                // byte width
9db9f7
 
9db9f7
     while (y < h) {                                // for all encoded bytes...
9db9f7
-        if (p) {                                // p = "0x.."
9db9f7
+        if (p && p < (buf + readBytes - 3)) {      // p = "0x.."
9db9f7
+            if (!isxdigit(p[2]) || !isxdigit(p[3]))
9db9f7
+                return false;
9db9f7
             *b++ = hex2byte(p+2);
9db9f7
             p += 2;
9db9f7
             if (++x == w && ++y < h) {