File netpbm-fixes.patch of Package netpbm

Index: buildtools/Makefile
===================================================================
--- buildtools/Makefile.orig
+++ buildtools/Makefile
@@ -34,10 +34,10 @@ libopt.o: libopt.c
 	  -o $@ $<
 
 typegen.o endiangen.o:%.o:%.c
-	$(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) -o $@ $<
+	$(CC_FOR_BUILD) $(CFLAGS) -c $(CFLAGS_FOR_BUILD) -o $@ $<
 
 $(PROGS):%:%.o
-	$(LD_FOR_BUILD) -o $@ $<
+	$(LD_FOR_BUILD) $(LDFLAGS) -o $@ $<
 
 distclean clean: cleanlocal
 .PHONY: cleanlocal
Index: converter/other/fiasco/codec/dfiasco.c
===================================================================
--- converter/other/fiasco/codec/dfiasco.c.orig
+++ converter/other/fiasco/codec/dfiasco.c
@@ -15,6 +15,7 @@
  */
 
 #include <string.h>
+#include <stdlib.h>
 
 #include "config.h"
 
Index: converter/other/fiasco/input/basis.c
===================================================================
--- converter/other/fiasco/input/basis.c.orig
+++ converter/other/fiasco/input/basis.c
@@ -14,6 +14,7 @@
  *  $State: Exp $
  */
 
+#include <string.h>
 #include "config.h"
 
 #include "types.h"
Index: converter/other/fitstopnm.c
===================================================================
--- converter/other/fitstopnm.c.orig
+++ converter/other/fitstopnm.c
@@ -444,7 +444,7 @@ read_val (fp, bitpix, vp)
             c[i] = ich;
         }
         swapbytes(c, 4);
-        *vp = *( (float *) c);
+        memcpy(vp, c, 4);
         break;
       
     case -64:
@@ -455,7 +455,7 @@ read_val (fp, bitpix, vp)
             c[i] = ich;
         }
         swapbytes(c, 8);
-        *vp = *( (double *) c);
+        memcpy(vp, c, 8);
         break;
       
     default:
Index: converter/other/jpegtopnm.c
===================================================================
--- converter/other/jpegtopnm.c.orig
+++ converter/other/jpegtopnm.c
@@ -511,6 +511,7 @@ set_color_spaces(const J_COLOR_SPACE jpe
         pm_error("Input JPEG image has 'unknown' color space "
                  "(JCS_UNKNOWN).\n"
                  "We cannot interpret this image.");
+        *output_type_p = PPM_TYPE; /* not reached */
         break;
     case JCS_GRAYSCALE:
         *output_type_p = PGM_TYPE;
@@ -538,6 +539,7 @@ set_color_spaces(const J_COLOR_SPACE jpe
     default:
         pm_error("Internal error: unknown color space code %d passed "
                  "to set_color_spaces().", jpeg_color_space);
+        *output_type_p = PPM_TYPE; /* not reached */
     }
     pm_message("WRITING %s FILE", 
                *output_type_p == PPM_TYPE ? "PPM" : "PGM");
Index: converter/other/pamtopfm.c
===================================================================
--- converter/other/pamtopfm.c.orig
+++ converter/other/pamtopfm.c
@@ -149,12 +149,12 @@ floatToPfmSample(float       const input
    Type converter
 -----------------------------------------------------------------------------*/
     if (machineEndianness == pfmEndianness) {
-        *(float *)outputP->bytes = input;
+        memcpy(outputP->bytes, &input, sizeof(float));
     } else {
         unsigned char reversed[sizeof(pfmSample)];
         unsigned int i, j;
 
-        *(float *)reversed = input;
+        memcpy(reversed, &input, sizeof(float));
         
         for (i = 0, j = sizeof(pfmSample)-1; 
              i < sizeof(pfmSample); 
@@ -239,6 +239,7 @@ makePfmHeader(const struct pam * const p
               enum endian        const endian) {
     
     struct pfmHeader pfmHeader;
+    memset(&pfmHeader, 0, sizeof(pfmHeader));
     
     pfmHeader.width  = pamP->width;
     pfmHeader.height = pamP->height;
Index: converter/other/pamtosvg/curve.c
===================================================================
--- converter/other/pamtosvg/curve.c.orig
+++ converter/other/pamtosvg/curve.c
@@ -222,9 +222,7 @@ curve_list_type
 new_curve_list (void)
 {
   curve_list_type curve_list;
-
-  curve_list.length = 0;
-  curve_list.data = NULL;
+  memset(&curve_list, 0, sizeof(curve_list));
 
   return curve_list;
 }
Index: converter/other/pamtosvg/pxl-outline.c
===================================================================
--- converter/other/pamtosvg/pxl-outline.c.orig
+++ converter/other/pamtosvg/pxl-outline.c
@@ -262,6 +262,9 @@ find_one_centerline(bitmap_type    const
     outline.open  = false;
     outline.color = getBitmapColor(bitmap, original_row, original_col);
 
+    search_dir = original_dir;  /* initial value */
+    row = original_row;         /* initial value */
+    col = original_col;         /* initial values */
     /* Add the starting pixel to the output list, changing from bitmap
        to Cartesian coordinates and specifying the left edge so that
        the coordinates won't be adjusted.
@@ -272,9 +275,6 @@ find_one_centerline(bitmap_type    const
         LOG2(" (%d,%d)", pos.col, pos.row);
         append_outline_pixel(&outline, pos);
     }
-    search_dir = original_dir;  /* initial value */
-    row = original_row;         /* initial value */
-    col = original_col;         /* initial values */
 
     for ( ; ; ) {
         unsigned int const prev_row = row;
@@ -527,6 +527,7 @@ new_pixel_outline (void)
 {
   pixel_outline_type pixel_outline;
 
+  memset(&pixel_outline, 0, sizeof(pixel_outline));
   O_LENGTH (pixel_outline) = 0;
   pixel_outline.data = NULL;
   pixel_outline.open = false;
Index: converter/other/pamtosvg/spline.c
===================================================================
--- converter/other/pamtosvg/spline.c.orig
+++ converter/other/pamtosvg/spline.c
@@ -80,6 +80,7 @@ spline_list_type
 empty_spline_list (void)
 {
   spline_list_type answer;
+  memset(&answer, 0, sizeof(answer));
   SPLINE_LIST_DATA (answer) = NULL;
   SPLINE_LIST_LENGTH (answer) = 0;
   return answer;
@@ -153,6 +154,7 @@ spline_list_array_type
 new_spline_list_array (void)
 {
   spline_list_array_type answer;
+  memset(&answer, 0, sizeof(answer));
 
   SPLINE_LIST_ARRAY_DATA (answer) = NULL;
   SPLINE_LIST_ARRAY_LENGTH (answer) = 0;
Index: converter/other/pamtouil.c
===================================================================
--- converter/other/pamtouil.c.orig
+++ converter/other/pamtouil.c
@@ -376,11 +376,15 @@ freeCmap(cixel_map cmap[], unsigned int
     int i;
 
     for (i = 0; i < ncolors; ++i) {
-        cixel_map const cmapEntry = cmap[i];
-        if (cmapEntry.uilname)
+        cixel_map cmapEntry = cmap[i];
+        if (cmapEntry.uilname) {
             freeString(cmapEntry.uilname);
-        if (cmapEntry.rgbname)
+	    cmapEntry.uilname = NULL;
+	}
+        if (cmapEntry.rgbname) {
             freeString(cmapEntry.rgbname);
+	    cmapEntry.rgbname = NULL;
+	}
     }
 }
 
Index: converter/other/pgmtopbm.c
===================================================================
--- converter/other/pgmtopbm.c.orig
+++ converter/other/pgmtopbm.c
@@ -549,6 +549,8 @@ createDither8Converter(unsigned int cons
     converter.cols = cols;
     converter.convertRow = &dither8ConvertRow;
     converter.destroy = NULL;
+    converter.stateP = NULL;
+    converter.maxval = 0;
 
     /* Scale dither matrix. */
     for (row = 0; row < 16; ++row) {
@@ -622,6 +624,7 @@ createClusterConverter(unsigned int cons
     converter.cols = cols;
     converter.convertRow = &clusterConvertRow;
     converter.destroy = &clusterDestroy;
+    converter.maxval = 0;
 
     MALLOCVAR_NOFAIL(stateP);
 
Index: converter/other/pnmtopng.c
===================================================================
--- converter/other/pnmtopng.c.orig
+++ converter/other/pnmtopng.c
@@ -513,6 +513,7 @@ xelToPngColor_16(xel const input,
     retval.green = PPM_GETG(scaled);
     retval.blue  = PPM_GETB(scaled);
     retval.gray  = PNM_GET1(scaled);
+    retval.index = 0;
 
     return retval;
 }
Index: converter/other/rletopnm.c
===================================================================
--- converter/other/rletopnm.c.orig
+++ converter/other/rletopnm.c
@@ -101,7 +101,7 @@ parseCommandLine(int argc, char ** argv,
     optStruct3 opt;
     unsigned int option_def_index;
 
-    unsigned int alphaoutSpec;
+    unsigned int alphaoutSpec = 0;
 
     MALLOCARRAY(option_def, 100);
 
Index: converter/ppm/ximtoppm.c
===================================================================
--- converter/ppm/ximtoppm.c.orig
+++ converter/ppm/ximtoppm.c
@@ -44,7 +44,7 @@ parseCommandLine(int argc, char ** argv,
 
     unsigned int option_def_index;
 
-    unsigned int alphaoutSpec;
+    unsigned int alphaoutSpec = 0;
 
     option_def_index = 0;   /* incremented by OPTENT3 */
     OPTENT3(0,   "alphaout",   OPT_STRING, 
Index: lib/pm.h
===================================================================
--- lib/pm.h.orig
+++ lib/pm.h
@@ -21,6 +21,7 @@
 #include <errno.h>
 #include <setjmp.h>
 #include <sys/stat.h>
+#include <string.h>
 
 #ifdef VMS
 #include <perror.h>
Index: lib/util/wordaccess_64_le.h
===================================================================
--- lib/util/wordaccess_64_le.h.orig
+++ lib/util/wordaccess_64_le.h
@@ -49,4 +49,5 @@ wordintClz(wordint const x){
         return (__builtin_clzll((long long int)x << (s - 8) * 8));
     else
         pm_error("Long long int is less than 64 bits on this machine"); 
+    return 0; /* unreached */
 }
Index: converter/other/fiasco/lib/image.c
===================================================================
--- converter/other/fiasco/lib/image.c.orig
+++ converter/other/fiasco/lib/image.c
@@ -239,7 +239,7 @@ alloc_image (unsigned width, unsigned he
    image->format      = format;
    image->reference_count = 1;
    
-   strcpy (image->id, "IFIASCO");
+   strncpy (image->id, "IFIASCO", 7);
 
    for (band = first_band (color); band <= last_band (color); band++)
       if (format == FORMAT_4_2_0 && band != Y)
openSUSE Build Service is sponsored by