summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-05-13 07:20:04 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-05-13 07:20:04 +0000
commit9107aa935060bd561dd6a02c20de4ba18ff3a764 (patch)
tree571a1e221f7408b960ee508fd2bd1d3fe5f6a393
parentdf48dc076940a45bf1891efa7db290eac1193b5b (diff)
texk/dvipdfm-x: Bug fix, problem reported by Richard M Kreuter <kreuter@progn.net>
git-svn-id: svn://tug.org/texlive/trunk@34002 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/dvipdfm-x/ChangeLog6
-rw-r--r--Build/source/texk/dvipdfm-x/pdfobj.c6
-rw-r--r--Build/source/texk/dvipdfm-x/pdfobj.h1
3 files changed, 8 insertions, 5 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog
index 2fc1e37b2b1..2c4895da93f 100644
--- a/Build/source/texk/dvipdfm-x/ChangeLog
+++ b/Build/source/texk/dvipdfm-x/ChangeLog
@@ -1,3 +1,9 @@
+2014-05-13 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * pdfobj.[ch] (pdf_unshift_array): Bug fix: correctly copy array
+ elements, using memmove(). Declare pdf_unshift_array as static.
+ Bug reported by Richard M Kreuter <kreuter@progn.net>.
+
2014-05-10 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
* bmpimage.c: Error exit instead of crashing for unsupported
diff --git a/Build/source/texk/dvipdfm-x/pdfobj.c b/Build/source/texk/dvipdfm-x/pdfobj.c
index 6991e63a58f..3c86d817c3c 100644
--- a/Build/source/texk/dvipdfm-x/pdfobj.c
+++ b/Build/source/texk/dvipdfm-x/pdfobj.c
@@ -1273,11 +1273,10 @@ pdf_shift_array (pdf_obj *array)
#endif
/* Prepend an object to an array */
-void
+static void
pdf_unshift_array (pdf_obj *array, pdf_obj *object)
{
pdf_array *data;
- int i;
TYPECHECK(array, PDF_ARRAY);
@@ -1286,8 +1285,7 @@ pdf_unshift_array (pdf_obj *array, pdf_obj *object)
data->max += ARRAY_ALLOC_SIZE;
data->values = RENEW(data->values, data->max, pdf_obj *);
}
- for (i = 0; i < data->size; i++)
- data->values[i+1] = data->values[i];
+ memmove(&data->values[1], data->values, data->size * sizeof(pdf_obj *));
data->values[0] = object;
data->size++;
}
diff --git a/Build/source/texk/dvipdfm-x/pdfobj.h b/Build/source/texk/dvipdfm-x/pdfobj.h
index c1588b2677a..41f5df3fa10 100644
--- a/Build/source/texk/dvipdfm-x/pdfobj.h
+++ b/Build/source/texk/dvipdfm-x/pdfobj.h
@@ -112,7 +112,6 @@ extern void pdf_put_array (pdf_obj *array, unsigned idx, pdf_obj *object
extern pdf_obj *pdf_get_array (pdf_obj *array, long idx);
extern unsigned pdf_array_length (pdf_obj *array);
-extern void pdf_unshift_array (pdf_obj *array, pdf_obj *object);
#if 0
extern pdf_obj *pdf_shift_array (pdf_obj *array);
extern pdf_obj *pdf_pop_array (pdf_obj *array);