qt_kde.patch 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. diff --git a/src/plugins/imageformats/svg/qsvgiohandler.cpp b/src/plugins/imageformats/svg/qsvgiohandler.cpp
  2. index 561e77e..12e0574 100644
  3. --- a/src/plugins/imageformats/svg/qsvgiohandler.cpp
  4. +++ b/src/plugins/imageformats/svg/qsvgiohandler.cpp
  5. @@ -191,6 +191,8 @@ bool QSvgIOHandler::read(QImage *image)
  6. }
  7. }
  8. if (!finalSize.isEmpty()) {
  9. + if (qMax(finalSize.width(), finalSize.height()) > 0xffff)
  10. + return false; // Assume corrupted file
  11. image->fill(d->backColor.rgba());
  12. QPainter p(image);
  13. d->r.render(&p, bounds);
  14. diff --git a/src/svg/qsvgfont_p.h b/src/svg/qsvgfont_p.h
  15. index fd0a3fa..fcffbe8 100644
  16. --- a/src/svg/qsvgfont_p.h
  17. +++ b/src/svg/qsvgfont_p.h
  18. @@ -74,6 +74,7 @@ public:
  19. class Q_SVG_PRIVATE_EXPORT QSvgFont : public QSvgRefCounted
  20. {
  21. public:
  22. + static constexpr qreal DEFAULT_UNITS_PER_EM = 1000;
  23. QSvgFont(qreal horizAdvX);
  24. void setFamilyName(const QString &name);
  25. @@ -86,9 +87,7 @@ public:
  26. void draw(QPainter *p, const QPointF &point, const QString &str, qreal pixelSize, Qt::Alignment alignment) const;
  27. public:
  28. QString m_familyName;
  29. - qreal m_unitsPerEm;
  30. - qreal m_ascent;
  31. - qreal m_descent;
  32. + qreal m_unitsPerEm = DEFAULT_UNITS_PER_EM;
  33. qreal m_horizAdvX;
  34. QHash<QChar, QSvgGlyph> m_glyphs;
  35. };
  36. diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp
  37. index c229c3b..222b6d8 100644
  38. --- a/src/svg/qsvghandler.cpp
  39. +++ b/src/svg/qsvghandler.cpp
  40. @@ -1393,9 +1393,10 @@ static void parseFont(QSvgNode *node,
  41. case FontSizeNone:
  42. break;
  43. case FontSizeValue: {
  44. - QSvgHandler::LengthType dummy; // should always be pixel size
  45. - fontStyle->setSize(qMin(parseLength(attributes.fontSize, dummy, handler),
  46. - qreal(0xffff)));
  47. + QSvgHandler::LengthType type;
  48. + qreal fs = parseLength(attributes.fontSize, type, handler);
  49. + fs = convertToPixels(fs, true, type);
  50. + fontStyle->setSize(qMin(fs, qreal(0xffff)));
  51. }
  52. break;
  53. default:
  54. @@ -2578,6 +2579,8 @@ static QSvgNode *createCircleNode(QSvgNode *parent,
  55. qreal ncx = toDouble(cx);
  56. qreal ncy = toDouble(cy);
  57. qreal nr = toDouble(r);
  58. + if (nr < 0.0)
  59. + return nullptr;
  60. QRectF rect(ncx-nr, ncy-nr, nr*2, nr*2);
  61. QSvgNode *circle = new QSvgCircle(parent, rect);
  62. @@ -2668,7 +2671,7 @@ static bool parseFontFaceNode(QSvgStyleProperty *parent,
  63. qreal unitsPerEm = toDouble(unitsPerEmStr);
  64. if (!unitsPerEm)
  65. - unitsPerEm = 1000;
  66. + unitsPerEm = QSvgFont::DEFAULT_UNITS_PER_EM;
  67. if (!name.isEmpty())
  68. font->setFamilyName(name);
  69. @@ -3048,15 +3051,16 @@ static QSvgStyleProperty *createRadialGradientNode(QSvgNode *node,
  70. qreal ncx = 0.5;
  71. qreal ncy = 0.5;
  72. - qreal nr = 0.5;
  73. if (!cx.isEmpty())
  74. ncx = toDouble(cx);
  75. if (!cy.isEmpty())
  76. ncy = toDouble(cy);
  77. +
  78. + qreal nr = 0.0;
  79. if (!r.isEmpty())
  80. nr = toDouble(r);
  81. - if (nr < 0.5)
  82. - nr = 0.5;
  83. + if (nr <= 0.0)
  84. + return nullptr;
  85. qreal nfx = ncx;
  86. if (!fx.isEmpty())
  87. @@ -3352,7 +3356,9 @@ static QSvgNode *createTextNode(QSvgNode *parent,
  88. //### editable and rotate not handled
  89. QSvgHandler::LengthType type;
  90. qreal nx = parseLength(x, type, handler);
  91. + nx = convertToPixels(nx, true, type);
  92. qreal ny = parseLength(y, type, handler);
  93. + ny = convertToPixels(ny, true, type);
  94. QSvgNode *text = new QSvgText(parent, QPointF(nx, ny));
  95. return text;
  96. diff --git a/src/svg/qsvgstructure.cpp b/src/svg/qsvgstructure.cpp
  97. index b89608b..89c9e4e 100644
  98. --- a/src/svg/qsvgstructure.cpp
  99. +++ b/src/svg/qsvgstructure.cpp
  100. @@ -255,9 +255,13 @@ inline static bool isSupportedSvgFeature(const QString &str)
  101. };
  102. if (str.length() <= MAX_WORD_LENGTH && str.length() >= MIN_WORD_LENGTH) {
  103. + const char16_t unicode44 = str.at(44).unicode();
  104. + const char16_t unicode45 = str.at(45).unicode();
  105. + if (unicode44 >= sizeof(asso_values) || unicode45 >= sizeof(asso_values))
  106. + return false;
  107. const int key = str.length()
  108. - + asso_values[str.at(45).unicode()]
  109. - + asso_values[str.at(44).unicode()];
  110. + + asso_values[unicode45]
  111. + + asso_values[unicode44];
  112. if (key <= MAX_HASH_VALUE && key >= 0)
  113. return str == QLatin1String(wordlist[key]);
  114. }