39f6a05
diff -up qt-everywhere-opensource-src-4.8.7/src/gui/image/qxbmhandler.cpp.me qt-everywhere-opensource-src-4.8.7/src/gui/image/qxbmhandler.cpp
39f6a05
--- qt-everywhere-opensource-src-4.8.7/src/gui/image/qxbmhandler.cpp.me	2020-08-13 11:20:45.943402169 +0200
39f6a05
+++ qt-everywhere-opensource-src-4.8.7/src/gui/image/qxbmhandler.cpp	2020-08-13 11:21:26.025976881 +0200
39f6a05
@@ -154,7 +154,9 @@ static bool read_xbm_body(QIODevice *dev
39f6a05
     w = (w+7)/8;                                // byte width
39f6a05
 
39f6a05
     while (y < h) {                                // for all encoded bytes...
39f6a05
-        if (p) {                                // p = "0x.."
39f6a05
+        if (p && p < (buf + readBytes - 3)) {      // p = "0x.."
39f6a05
+            if (!isxdigit(p[2]) || !isxdigit(p[3]))
39f6a05
+                return false;
39f6a05
             *b++ = hex2byte(p+2);
39f6a05
             p += 2;
39f6a05
             if (++x == w && ++y < h) {