Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 cxref (1.6e-3) unstable; urgency=high
 .
   * Bug fix: "cxref FTBFS on amd64/i386 with glibc 2.26", thanks to Adrian
     Bunk (Closes: #887866).
   * Added homepage entry to control
   * Bug fix: "please add Homepage field", thanks to Juhani Numminen
     (Closes: #888483).
   * Bug fix: "Duplicate and conflicting definition of function
     check_assertion", thanks to Michael Tautschnig (Closes: #748116).
     Fixed in 1.6e upstream.
   * Bug fix: "maintainer script(s) do not start on #!", thanks to
     treinen@debian.org</a>; (Closes: #843271).
   * Bug fix: "maintainer script(s) not using strict mode", thanks to
     treinen@debian.org</a>; (Closes: #866264).
   * compat level 9
   * dh_prep
Author: Camm Maguire <camm@debian.org>
Bug-Debian: https://bugs.debian.org/748116
Bug-Debian: https://bugs.debian.org/843271
Bug-Debian: https://bugs.debian.org/866264
Bug-Debian: https://bugs.debian.org/887866
Bug-Debian: https://bugs.debian.org/888483

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2018-01-30

--- cxref-1.6e.orig/cpp/cccp.c
+++ cxref-1.6e/cpp/cccp.c
@@ -4291,7 +4291,7 @@ special_symbol (hp, op)
       if (instack[i].fname != NULL)
         true_indepth++;
 
-    buf = (char *) alloca (8);	/* Eight bytes ought to be more than enough */
+    buf = (char *) alloca (11);	/* Eight bytes ought to be more than enough */
     sprintf (buf, "%d", true_indepth - 1);
     break;
 
--- cxref-1.6e.orig/doc/Makefile.in
+++ cxref-1.6e/doc/Makefile.in
@@ -98,8 +98,8 @@ faq-html : $(srcdir)/FAQ $(srcdir)/FAQ-h
 
 readme : $(srcdir)/README.c
 	[ -f README.c ] || cp $(srcdir)/README.c .
-	../src/cxref -O. -NREADME-TMP -xref README.c
-	../src/cxref -O. -NREADME-TMP -xref README.c -latex -html-src -rtf -sgml
+	../src/cxref  -D_Float128='long double' -O. -NREADME-TMP -xref README.c
+	../src/cxref  -D_Float128='long double' -O. -NREADME-TMP -xref README.c -latex -html-src -rtf -sgml
 	mv README.c.tex README_c.tex
 	[ "x$(LATEX)" = "x" ] || $(LATEX) $(srcdir)/README.tex > /dev/null 2>&1
 	[ "x$(LATEX)" = "x" ] || $(LATEX) $(srcdir)/README.tex
--- cxref-1.6e.orig/query/input.c
+++ cxref-1.6e/query/input.c
@@ -72,6 +72,17 @@ static void cross_reference_variables(vo
   Read in all the information from the cross reference files.
   ++++++++++++++++++++++++++++++++++++++*/
 
+#include <errno.h>
+#define massert(a_) \
+  ({errno=0;\
+    if (!(a_)||errno) {\
+      fprintf(stderr,"The assertion %s on line %d of %s in function %s failed: %s",\
+	      #a_,__LINE__,__FILE__,__FUNCTION__,strerror(errno));\
+      exit(1);\
+    }\
+  })
+
+
 void LoadInCrossRefs(void)
 {
  FILE *in;
@@ -108,7 +119,7 @@ void LoadInCrossRefs(void)
          {
           Include inc=(Include)Calloc(1,sizeof(struct _Include));
 
-          fscanf(in,"%s%c",include,&ch);
+          massert(fscanf(in,"%s%c",include,&ch)!=EOF);
 
           if(include[0]=='%')
              {inc->scope=LOCAL;
@@ -181,7 +192,7 @@ void LoadInCrossRefs(void)
        while(ch==' ')
          {
           char* c;
-          fscanf(in,"%s%c",called,&ch);
+          massert(fscanf(in,"%s%c",called,&ch)!=EOF);
 
           c=called;
           if(c[0]=='%') c++;
@@ -248,7 +259,7 @@ void LoadInCrossRefs(void)
 
        while(ch==' ')
          {
-          fscanf(in,"%s%c",funcname,&ch);
+	   massert(fscanf(in,"%s%c",funcname,&ch)!=EOF);
 
           if(funcname[0]=='$')
              AddToStringList2(variables[n_variables]->used,"$",filename,1,0);
@@ -284,7 +295,7 @@ void LoadInCrossRefs(void)
       {
        int i;
 
-       fgets(typetype,TYPE_MAX_LEN,in);
+       massert(fgets(typetype,TYPE_MAX_LEN,in)!=NULL);
        typetype[strlen(typetype)-1]=0;
 
        if(n_typedefs)
--- cxref-1.6e.orig/src/cxref.c
+++ cxref-1.6e/src/cxref.c
@@ -948,7 +948,8 @@ static FILE* popen_execvp(char** command
  else                            /* The child */
    {
     close(1);
-    dup(fdr[1]);
+    if (dup(fdr[1])==-1)
+      {fprintf(stderr,"cxref: Can not dup(licate) pipe outputfor '%s'.\n",command[0]);exit(1);}
     close(fdr[1]);
 
     close(fdr[0]);
--- cxref-1.6e.orig/src/xref.c
+++ cxref-1.6e/src/xref.c
@@ -75,6 +75,15 @@ static void fixup_extern_var(Variable va
 
   int outputs Set to true if any cross referencing to produce outputs is required.
   ++++++++++++++++++++++++++++++++++++++*/
+#include <errno.h>
+#define massert(a_) \
+  ({errno=0;\
+    if (!(a_)||errno) {\
+      fprintf(stderr,"The assertion %s on line %d of %s in function %s failed: %s",\
+	      #a_,__LINE__,__FILE__,__FUNCTION__,strerror(errno));\
+      exit(1);\
+    }\
+  })
 
 void CrossReference(File file,int outputs)
 {
@@ -115,7 +124,7 @@ void CrossReference(File file,int output
 
           while(ch==' ')
             {
-             fscanf(in,"%s%c",include,&ch);
+	      massert(fscanf(in,"%s%c",include,&ch)!=EOF);
 
              if(diff_file)
                 fprintf(out," %s",include);
@@ -222,7 +231,7 @@ void CrossReference(File file,int output
 
           while(ch==' ')
             {
-             fscanf(in,"%s%c",called,&ch);
+	      massert(fscanf(in,"%s%c",called,&ch)!=EOF);
 
              if(diff_file)
                {
@@ -300,7 +309,7 @@ void CrossReference(File file,int output
 
           while(ch==' ')
             {
-             fscanf(in,"%s%c",funcname,&ch);
+	      massert(fscanf(in,"%s%c",funcname,&ch)!=EOF);
 
              if(diff_file)
                {
@@ -372,7 +381,7 @@ void CrossReference(File file,int output
           if(diff_file)
              fprintf(out,"%s %s",filename,typename);
 
-          fgets(typename,TYPE_MAX_LEN,in);
+          massert(fgets(typename,TYPE_MAX_LEN,in)!=NULL);
 
           if(diff_file)
              fputs(typename,out);
@@ -644,7 +653,7 @@ void CreateAppendix(StringList files,Str
          {
           AddToStringList(files,filename,1,1);
           while(ch==' ')
-             fscanf(in,"%s%c",include,&ch);
+	    massert(fscanf(in,"%s%c",include,&ch)!=EOF);
          }
 
        fclose(in);
@@ -667,7 +676,7 @@ void CreateAppendix(StringList files,Str
           if(scope&GLOBAL)
              AddToStringList2(funcs,caller,filename,1,1);
           while(ch==' ')
-             fscanf(in,"%s%c",called,&ch);
+	    massert(fscanf(in,"%s%c",called,&ch)!=EOF);
          }
 
        fclose(in);
@@ -690,7 +699,7 @@ void CreateAppendix(StringList files,Str
           if(scope&GLOBAL)
              AddToStringList2(vars,variable,filename,1,1);
           while(ch==' ')
-             fscanf(in,"%s%c",funcname,&ch);
+	    massert(fscanf(in,"%s%c",funcname,&ch)!=EOF);
          }
 
        fclose(in);
@@ -711,14 +720,14 @@ void CreateAppendix(StringList files,Str
          {
           if(typename[0]=='#')
             {
-             fgets(typename,TYPE_MAX_LEN,in);
+	      massert(fgets(typename,TYPE_MAX_LEN,in)!=NULL);
              typename[strlen(typename)-1]=0;
              AddToStringList2(types,&typename[1],filename,1,1);
             }
           else
             {
              AddToStringList2(types,typename,filename,1,1);
-             fgets(typename,TYPE_MAX_LEN,in);
+             massert(fgets(typename,TYPE_MAX_LEN,in)!=NULL);
             }
          }
 
@@ -762,7 +771,7 @@ void CrossReferenceDelete(char *name)
 
        while(ch==' ')
          {
-          fscanf(in,"%s%c",include,&ch);
+	   massert(fscanf(in,"%s%c",include,&ch)!=EOF);
 
           if(diff_file)
              fprintf(out," %s",include);
@@ -808,7 +817,7 @@ void CrossReferenceDelete(char *name)
 
        while(ch==' ')
          {
-          fscanf(in,"%s%c",called,&ch);
+	   massert(fscanf(in,"%s%c",called,&ch)!=EOF);
           if(diff_file)
              fprintf(out," %s",called);
          }
@@ -853,7 +862,7 @@ void CrossReferenceDelete(char *name)
 
        while(ch==' ')
          {
-          fscanf(in,"%s%c",funcname,&ch);
+	   massert(fscanf(in,"%s%c",funcname,&ch)!=EOF);
 
           if(diff_file)
              fprintf(out," %s",funcname);
@@ -896,7 +905,7 @@ void CrossReferenceDelete(char *name)
        if(diff_file)
           fprintf(out,"%s %s",filename,typename);
 
-       fgets(typename,TYPE_MAX_LEN,in);
+       massert(fgets(typename,TYPE_MAX_LEN,in)!=NULL);
 
        if(diff_file)
           fputs(typename,out);
