diff --git a/Makefile b/Makefile
index 0c567cb188cbd5dad999da26ad13657dc0ffe2a8..266c4b79f58a3cfca5bacaf6a96afce919a42c76 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-RELEASE = 1.2.5
+RELEASE = 1.2.6
 DATE = `date "+%Y%m%d"`
 
 clean:
@@ -32,6 +32,7 @@ test:
            -Wsign-compare -Wpointer-arith -Wundef -ansi -pedantic\
            -c gl2ps.c
 	g++ -O3 -Wall -ansi -pedantic -c gl2ps.c
+	g++ -g -O3 -W -Wall -ansi -pedantic -c gl2psTest.c
 
 distrib:
 	rm -rf gl2ps-${RELEASE}/ gl2ps-${RELEASE}.tgz
diff --git a/doc/gl2ps.tex b/doc/gl2ps.tex
index 582ab0d7987721ed98fd705dc092c19cf3b7ea29..d7a971c7947446d8f3a3d00abde4e26d5a90b7b9 100644
--- a/doc/gl2ps.tex
+++ b/doc/gl2ps.tex
@@ -1,4 +1,4 @@
-%  $Id: gl2ps.tex,v 1.199 2005-06-19 19:18:35 geuzaine Exp $
+%  $Id: gl2ps.tex,v 1.200 2005-06-23 07:04:59 geuzaine Exp $
 %
 %  GL2PS, an OpenGL to PostScript Printing Library
 %  Copyright (C) 1999-2005 Christophe Geuzaine <geuz@geuz.org>
@@ -58,13 +58,13 @@
 
 \title{GL2PS: an OpenGL to PostScript printing library}
 \author{Christophe Geuzaine}
-\date{Version 1.2.5, 18 June 2005}
+\date{Version 1.2.6, 22 June 2005}
 
 \maketitle
 
 %%tth: \section*{Download}
 %%tth: The current distribution of GL2PS is
-%%tth: \href{http://www.geuz.org/gl2ps/src/gl2ps-1.2.5.tgz}{gl2ps-1.2.5.tgz}.
+%%tth: \href{http://www.geuz.org/gl2ps/src/gl2ps-1.2.6.tgz}{gl2ps-1.2.6.tgz}.
 %%tth: This distribution contains a complete
 %%tth: \href{http://www.geuz.org/gl2ps/gl2ps.pdf}
 %%tth: {documentation in PDF format}. Older versions are still
@@ -886,6 +886,11 @@ does not seem to be available anymore).
 \item[1.2.5] (Jun 18, 2005) Fixed a couple of uninitialized variables in
   PDF code; new \dd{GL2PS_TIGHT_BOUNDING_BOX} option; added rotated
   text support for PostScript output.
+\item[1.2.6] (Jun 22, 2005) Fixed crash when creating PDF file with
+  overflowing feedback buffer (bug introduced in 1.2.5); added
+  additional example program \dd{gl2psTestSimple.c} to the
+  distribution.
+
 \end{description}
 
 \end{document}
diff --git a/gl2ps.c b/gl2ps.c
index 067691d0130f815732593452c504504837ac48e5..2b9fea6b0877ebcd8ac22a5a14ced703b42cf8a9 100644
--- a/gl2ps.c
+++ b/gl2ps.c
@@ -1,4 +1,4 @@
-/* $Id: gl2ps.c,v 1.212 2005-06-20 17:32:24 geuzaine Exp $ */
+/* $Id: gl2ps.c,v 1.213 2005-06-23 07:04:59 geuzaine Exp $ */
 /*
  * GL2PS, an OpenGL to PostScript Printing Library
  * Copyright (C) 1999-2005 Christophe Geuzaine <geuz@geuz.org>
@@ -4672,17 +4672,19 @@ GL2PSDLL_API GLint gl2psEndPage(void)
 
   res = gl2psPrintPrimitives();
 
-  switch(gl2ps->format){
-  case GL2PS_TEX :
-    gl2psPrintTeXFooter();
-    break;
-  case GL2PS_PS :
-  case GL2PS_EPS :
-    gl2psPrintPostScriptFooter();
-    break;
-  case GL2PS_PDF :
-    gl2psPrintPDFFooter();
-    break;
+  if(res != GL2PS_OVERFLOW){
+    switch(gl2ps->format){
+    case GL2PS_TEX :
+      gl2psPrintTeXFooter();
+      break;
+    case GL2PS_PS :
+    case GL2PS_EPS :
+      gl2psPrintPostScriptFooter();
+      break;
+    case GL2PS_PDF :
+      gl2psPrintPDFFooter();
+      break;
+    }
   }
 
   fflush(gl2ps->stream);
diff --git a/gl2ps.h b/gl2ps.h
index 277e61663d4f23fff7f11cfdcd839516b1dfc94a..bd6717cac766a61652b8e8a3d1bc2450ef22d438 100644
--- a/gl2ps.h
+++ b/gl2ps.h
@@ -1,4 +1,4 @@
-/* $Id: gl2ps.h,v 1.99 2005-06-18 18:06:20 geuzaine Exp $ */
+/* $Id: gl2ps.h,v 1.100 2005-06-23 07:04:59 geuzaine Exp $ */
 /*
  * GL2PS, an OpenGL to PostScript Printing Library
  * Copyright (C) 1999-2005 Christophe Geuzaine <geuz@geuz.org>
@@ -77,7 +77,7 @@
 
 #define GL2PS_MAJOR_VERSION 1
 #define GL2PS_MINOR_VERSION 2
-#define GL2PS_PATCH_VERSION 5
+#define GL2PS_PATCH_VERSION 6
 
 #define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
                        0.01 * GL2PS_MINOR_VERSION + \
diff --git a/gl2psTest.c b/gl2psTest.c
index ee601fea8d912f2084deb1b9f3b831cbbba33a2e..a596e168cd100f463eb5d9cbcbc88418d9d5124c 100644
--- a/gl2psTest.c
+++ b/gl2psTest.c
@@ -1,4 +1,4 @@
-/* $Id: gl2psTest.c,v 1.69 2005-06-19 19:18:35 geuzaine Exp $ */
+/* $Id: gl2psTest.c,v 1.70 2005-06-23 07:04:59 geuzaine Exp $ */
 /*
  * GL2PS, an OpenGL to PostScript Printing Library
  * Copyright (C) 1999-2005 Christophe Geuzaine <geuz@geuz.org>
@@ -236,7 +236,7 @@ void objects(void){
 }
 
 void printstring(char *string){
-  int len, i;
+  unsigned int i;
   char *fonts[] = 
     { "Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic",
       "Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-BoldOblique",
@@ -247,8 +247,7 @@ void printstring(char *string){
      changes the raster position... */
   gl2psText(string, fonts[4], 12);
 
-  len = (int)strlen(string);
-  for (i = 0; i < len; i++)
+  for (i = 0; i < strlen(string); i++)
     glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, string[i]);
 }
 
@@ -469,7 +468,7 @@ void reshape(int w, int h){
 }
 
 void writefile(int format, int sort, int options, int nbcol,
-               char *filename, char *extension){
+               char *filename, const char *extension){
   FILE *fp;
   char file[256];
   int state = GL2PS_OVERFLOW, buffsize = 0;
@@ -511,7 +510,6 @@ void writefile(int format, int sort, int options, int nbcol,
 
 void keyboard(unsigned char key, int x, int y){
   int opt;
-  char *ext;
   static int format = GL2PS_EPS;
 
   switch(key){
@@ -539,40 +537,41 @@ void keyboard(unsigned char key, int x, int y){
     break;
   case 's':
     opt = GL2PS_DRAW_BACKGROUND;
-    ext = (format == GL2PS_EPS) ? "eps" : "pdf";
-    writefile(format, GL2PS_SIMPLE_SORT, opt, 0, "outSimple", ext);
+    writefile(format, GL2PS_SIMPLE_SORT, opt, 0, "outSimple",
+	      (format == GL2PS_EPS) ? "eps" : "pdf");
 
 #ifdef GL2PS_HAVE_ZLIB
     opt = GL2PS_DRAW_BACKGROUND | GL2PS_COMPRESS;
-    ext = (format == GL2PS_EPS) ? "eps.gz" : "pdf";
-    writefile(format, GL2PS_SIMPLE_SORT, opt, 0, "outSimpleCompressed", ext);
+    writefile(format, GL2PS_SIMPLE_SORT, opt, 0, "outSimpleCompressed", 
+	      (format == GL2PS_EPS) ? "eps.gz" : "pdf");
 #endif
 
     opt = GL2PS_OCCLUSION_CULL | GL2PS_DRAW_BACKGROUND;
-    ext = (format == GL2PS_EPS) ? "eps" : "pdf";
-    writefile(format, GL2PS_SIMPLE_SORT, opt, 0, "outSimpleCulled", ext);
+    writefile(format, GL2PS_SIMPLE_SORT, opt, 0, "outSimpleCulled",
+	      (format == GL2PS_EPS) ? "eps" : "pdf");
 
     opt = GL2PS_NO_PS3_SHADING | GL2PS_DRAW_BACKGROUND | GL2PS_TIGHT_BOUNDING_BOX;
-    ext = (format == GL2PS_EPS) ? "eps" : "pdf";
-    writefile(format, GL2PS_SIMPLE_SORT, opt, 2, "outSimpleShading2", ext);
-    writefile(format, GL2PS_SIMPLE_SORT, opt, 8, "outSimpleShading8", ext);
-    writefile(format, GL2PS_SIMPLE_SORT, opt, 16, "outSimpleShading16", ext);
+    writefile(format, GL2PS_SIMPLE_SORT, opt, 2, "outSimpleShading2", 
+	      (format == GL2PS_EPS) ? "eps" : "pdf");
+    writefile(format, GL2PS_SIMPLE_SORT, opt, 8, "outSimpleShading8",
+	      (format == GL2PS_EPS) ? "eps" : "pdf");
+    writefile(format, GL2PS_SIMPLE_SORT, opt, 16, "outSimpleShading16",
+	      (format == GL2PS_EPS) ? "eps" : "pdf");
 
     opt = GL2PS_BEST_ROOT | GL2PS_DRAW_BACKGROUND;
-    ext = (format == GL2PS_EPS) ? "eps" : "pdf";
-    writefile(format, GL2PS_BSP_SORT, opt, 0, "outBsp", ext);
+    writefile(format, GL2PS_BSP_SORT, opt, 0, "outBsp",
+	      (format == GL2PS_EPS) ? "eps" : "pdf");
 
-    opt = GL2PS_OCCLUSION_CULL | GL2PS_BEST_ROOT | GL2PS_DRAW_BACKGROUND;
-    ext = (format == GL2PS_EPS) ? "eps" : "pdf";
-    writefile(format, GL2PS_BSP_SORT, opt, 0, "outBspCulled", ext);
+    opt = GL2PS_OCCLUSION_CULL | GL2PS_BEST_ROOT | GL2PS_DRAW_BACKGROUND;    
+    writefile(format, GL2PS_BSP_SORT, opt, 0, "outBspCulled",
+	      (format == GL2PS_EPS) ? "eps" : "pdf");
 
     opt = GL2PS_OCCLUSION_CULL | GL2PS_BEST_ROOT | GL2PS_NO_TEXT;
-    ext = (format == GL2PS_EPS) ? "eps" : "pdf";
-    writefile(format, GL2PS_BSP_SORT, opt, 0, "outLatex", ext);
+    writefile(format, GL2PS_BSP_SORT, opt, 0, "outLatex",
+	      (format == GL2PS_EPS) ? "eps" : "pdf");
 
     opt = GL2PS_NONE;
-    ext = "tex";
-    writefile(GL2PS_TEX, GL2PS_BSP_SORT, opt, 0, "outLatex", ext);
+    writefile(GL2PS_TEX, GL2PS_BSP_SORT, opt, 0, "outLatex", "tex");
 
     printf("GL2PS %d.%d.%d done with all images\n",
            GL2PS_MAJOR_VERSION, GL2PS_MINOR_VERSION, GL2PS_PATCH_VERSION);
diff --git a/gl2psTestSimple.c b/gl2psTestSimple.c
index ab2acce9d95206b0b0fca858d54d5832c6853d71..6ac48a31e0f4cb98f06a9c81677504a7b607967d 100644
--- a/gl2psTestSimple.c
+++ b/gl2psTestSimple.c
@@ -1,4 +1,4 @@
-/* $Id: gl2psTestSimple.c,v 1.8 2005-06-19 19:18:35 geuzaine Exp $ */
+/* $Id: gl2psTestSimple.c,v 1.9 2005-06-23 07:04:59 geuzaine Exp $ */
 /*
  * GL2PS, an OpenGL to PostScript Printing Library
  * Copyright (C) 1999-2005 Christophe Geuzaine <geuz@geuz.org>
@@ -50,7 +50,7 @@
 #include "gl2ps.h"
 
 void display(void){
-  int i;
+  unsigned int i;
   char *help = "Press 's' to save image or 'q' to quit";  
 
   glClearColor(0.3, 0.5, 0.8, 0.);