summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/silgraphite/files/silgraphite-2.3.1-aligned_access.patch')
-rw-r--r--media-libs/silgraphite/files/silgraphite-2.3.1-aligned_access.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/media-libs/silgraphite/files/silgraphite-2.3.1-aligned_access.patch b/media-libs/silgraphite/files/silgraphite-2.3.1-aligned_access.patch
new file mode 100644
index 000000000000..ee5c1702e92e
--- /dev/null
+++ b/media-libs/silgraphite/files/silgraphite-2.3.1-aligned_access.patch
@@ -0,0 +1,63 @@
+Fix unaligned reads.
+https://bugs.gentoo.org/show_bug.cgi?id=304921
+
+Upstream:
+https://sourceforge.net/tracker/?func=detail&aid=2995413&group_id=66144&atid=513479
+
+Index: silgraphite-2.3.1/engine/src/segment/FileInput.cpp
+===================================================================
+--- silgraphite-2.3.1.orig/engine/src/segment/FileInput.cpp
++++ silgraphite-2.3.1/engine/src/segment/FileInput.cpp
+@@ -41,6 +41,10 @@ DEFINE_THIS_FILE
+
+ //:End Ignore
+
++#define RAW_READ(var,size,buf) \
++ for(int i = 0; i < isizeof(size);i++){\
++ var |= buf[i]<<8*(isizeof(size)-i-1);\
++ }
+ //:>********************************************************************************************
+ //:> Forward declarations
+ //:>********************************************************************************************
+@@ -133,11 +137,11 @@ byte GrBufferIStream::ReadByteFromFont()
+ ----------------------------------------------------------------------------------------------*/
+ short GrBufferIStream::ReadShortFromFont()
+ {
+- short snInput = *(short *)m_pbNext;
++ short snInput = 0;
++ RAW_READ(snInput,short,m_pbNext);
+ m_pbNext += isizeof(short);
+ if (m_pbLim && m_pbNext > m_pbLim)
+ THROW(kresReadFault);
+- snInput = lsbf(snInput);
+ return snInput;
+ }
+
+@@ -147,11 +151,11 @@ short GrBufferIStream::ReadShortFromFont
+ ----------------------------------------------------------------------------------------------*/
+ utf16 GrBufferIStream::ReadUShortFromFont()
+ {
+- utf16 chwInput = *(utf16 *)m_pbNext;
++ utf16 chwInput = 0;
++ RAW_READ(chwInput,utf16,m_pbNext);
+ m_pbNext += isizeof(utf16);
+ if (m_pbLim && m_pbNext > m_pbLim)
+ THROW(kresReadFault);
+- chwInput = lsbf(chwInput);
+ return chwInput;
+ }
+
+@@ -161,11 +165,11 @@ utf16 GrBufferIStream::ReadUShortFromFon
+ ----------------------------------------------------------------------------------------------*/
+ int GrBufferIStream::ReadIntFromFont()
+ {
+- int nInput = *(int *)m_pbNext;
++ int nInput = 0;
++ RAW_READ(nInput,int,m_pbNext);
+ m_pbNext += isizeof(int);
+ if (m_pbLim && m_pbNext > m_pbLim)
+ THROW(kresReadFault);
+- nInput = lsbf(nInput);
+ return nInput;
+ }
+