[Python-modules-commits] r11890 - in packages/gamera/trunk/debian (3 files)
jwilk at users.alioth.debian.org
jwilk at users.alioth.debian.org
Mon Feb 22 22:49:52 UTC 2010
Date: Monday, February 22, 2010 @ 22:49:50
Author: jwilk
Revision: 11890
Fix unaligned memory access in the generated C code (closes: #570953).
(fix-unaligned-access.diff)
Added:
packages/gamera/trunk/debian/patches/fix-unaligned-access.diff
Modified:
packages/gamera/trunk/debian/changelog
packages/gamera/trunk/debian/patches/series
Modified: packages/gamera/trunk/debian/changelog
===================================================================
--- packages/gamera/trunk/debian/changelog 2010-02-22 21:29:38 UTC (rev 11889)
+++ packages/gamera/trunk/debian/changelog 2010-02-22 22:49:50 UTC (rev 11890)
@@ -2,10 +2,12 @@
* Link _png_support.so with libpng on all Unix architectures (closes:
#570809). (png-support-libpng.diff)
+ * Fix unaligned memory access in the generated C code (closes: #570953).
+ (fix-unaligned-access.diff)
* Really remove upstream-applied patches from the source package.
* Replace patch fixing TIFF export with the one applied upstream.
- -- Jakub Wilk <jwilk at debian.org> Mon, 22 Feb 2010 14:58:31 +0100
+ -- Jakub Wilk <jwilk at debian.org> Mon, 22 Feb 2010 20:45:23 +0100
gamera (3.2.4-1) unstable; urgency=low
Added: packages/gamera/trunk/debian/patches/fix-unaligned-access.diff
===================================================================
--- packages/gamera/trunk/debian/patches/fix-unaligned-access.diff (rev 0)
+++ packages/gamera/trunk/debian/patches/fix-unaligned-access.diff 2010-02-22 22:49:50 UTC (rev 11890)
@@ -0,0 +1,52 @@
+Description: Fix unaligned memory access in the generated C code.
+Author: Jakub Wilk <jwilk at debian.org>
+Bug: http://tech.groups.yahoo.com/group/gamera-devel/message/1952
+Bug-Debian: http://bugs.debian.org/570953
+
+Index: gamera-3.2.4/gamera/generate.py
+===================================================================
+--- gamera-3.2.4.orig/gamera/generate.py 2009-07-03 17:21:42.000000000 +0200
++++ gamera-3.2.4/gamera/generate.py 2010-02-22 21:17:23.000000000 +0100
+@@ -182,11 +182,23 @@
+ [[end]]
+
+ [[if function.feature_function]]
++ PyObject* array = 0;
+ feature_t* feature_buffer = 0;
+- PyObject* str = 0;
+ if (offset < 0) {
+- str = PyString_FromStringAndSize(NULL, [[function.return_type.length]] * sizeof(feature_t));
+- feature_buffer = (feature_t*)PyString_AsString(str);
++ void* feature_buffer_v = 0;
++ Py_ssize_t feature_buffer_len;
++ PyObject *str = PyString_FromStringAndSize(NULL, [[function.return_type.length]] * sizeof(feature_t));
++ if (str == 0)
++ return 0;
++ PyObject* array_init = get_ArrayInit();
++ if (array_init == 0)
++ return 0;
++ array = PyObject_CallFunction(
++ array_init, (char *)\"sO\", (char *)\"d\", str);
++ Py_DECREF(str);
++ if (PyObject_AsWriteBuffer(array, &feature_buffer_v, &feature_buffer_len) < 0)
++ return 0;
++ feature_buffer = (feature_t*)feature_buffer_v;
+ } else {
+ if (self_arg->features_len < offset + [[function.return_type.length]]) {
+ PyErr_Format(PyExc_ValueError, \"Offset as given (%d) will cause data to be written outside of array of length (%d). Perhaps the feature array is not initialised?\", offset, (int)self_arg->features_len);
+@@ -212,14 +224,7 @@
+ [[end]]
+
+ [[if function.feature_function]]
+- if (str != 0) {
+- [[# This is pretty expensive, but simple #]]
+- PyObject* array_init = get_ArrayInit();
+- if (array_init == 0)
+- return 0;
+- PyObject* array = PyObject_CallFunction(
+- array_init, (char *)\"sO\", (char *)\"d\", str);
+- Py_DECREF(str);
++ if (array != 0) {
+ return array;
+ } else {
+ Py_INCREF(Py_None);
Modified: packages/gamera/trunk/debian/patches/series
===================================================================
--- packages/gamera/trunk/debian/patches/series 2010-02-22 21:29:38 UTC (rev 11889)
+++ packages/gamera/trunk/debian/patches/series 2010-02-22 22:49:50 UTC (rev 11890)
@@ -1,3 +1,4 @@
+fix-unaligned-access.diff
tiff-support-64bit.diff
png-support-libpng.diff
gendoc-use-wxversion.diff
More information about the Python-modules-commits
mailing list