rpms/quake3/devel jpeg_memsrc.c, NONE, 1.1 jpeg_memsrc.h, NONE, 1.1 quake3-1.36-syslibs.patch, NONE, 1.1 quake3.spec, 1.15, 1.16

Xavier LAMIEN laxathom at fedoraproject.org
Thu May 13 13:11:34 UTC 2010


Author: laxathom

Update of /cvs/pkgs/rpms/quake3/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv9135/devel

Modified Files:
	quake3.spec 
Added Files:
	jpeg_memsrc.c jpeg_memsrc.h quake3-1.36-syslibs.patch 
Log Message:
Update to current svn revision (including security fix)


--- NEW FILE jpeg_memsrc.c ---
/*
* memsrc.c
*
* Copyright (C) 1994-1996, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains decompression data source routines for the case of
* reading JPEG data from a memory buffer that is preloaded with the entire
* JPEG file. This would not seem especially useful at first sight, but
* a number of people have asked for it.
* This is really just a stripped-down version of jdatasrc.c. Comparison
* of this code with jdatasrc.c may be helpful in seeing how to make
* custom source managers for other purposes.
*/

/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
#include <stdio.h>
#include <jpeglib.h>
#include <jerror.h>


/* Expanded data source object for memory input */

typedef struct {
struct jpeg_source_mgr pub; /* public fields */

JOCTET eoi_buffer[2]; /* a place to put a dummy EOI */
} my_source_mgr;

typedef my_source_mgr * my_src_ptr;


/*
* Initialize source --- called by jpeg_read_header
* before any data is actually read.
*/

METHODDEF(void)
init_source (j_decompress_ptr cinfo)
{
/* No work, since jpeg_mem_src set up the buffer pointer and count.
* Indeed, if we want to read multiple JPEG images from one buffer,
* this *must* not do anything to the pointer.
*/
}


/*
* Fill the input buffer --- called whenever buffer is emptied.
*
* In this application, this routine should never be called; if it is called,
* the decompressor has overrun the end of the input buffer, implying we
* supplied an incomplete or corrupt JPEG datastream. A simple error exit
* might be the most appropriate response.
*
* But what we choose to do in this code is to supply dummy EOI markers
* in order to force the decompressor to finish processing and supply
* some sort of output image, no matter how corrupted.
*/

METHODDEF(boolean)
fill_input_buffer (j_decompress_ptr cinfo)
{
my_src_ptr src = (my_src_ptr) cinfo->src;

WARNMS(cinfo, JWRN_JPEG_EOF);

/* Create a fake EOI marker */
src->eoi_buffer[0] = (JOCTET) 0xFF;
src->eoi_buffer[1] = (JOCTET) JPEG_EOI;
src->pub.next_input_byte = src->eoi_buffer;
src->pub.bytes_in_buffer = 2;

return TRUE;
}


/*
* Skip data --- used to skip over a potentially large amount of
* uninteresting data (such as an APPn marker).
*
* If we overrun the end of the buffer, we let fill_input_buffer deal with
* it. An extremely large skip could cause some time-wasting here, but
* it really isn't supposed to happen ... and the decompressor will never
* skip more than 64K anyway.
*/

METHODDEF(void)
skip_input_data (j_decompress_ptr cinfo, long num_bytes)
{
my_src_ptr src = (my_src_ptr) cinfo->src;

if (num_bytes > 0) {
while (num_bytes > (long) src->pub.bytes_in_buffer) {
num_bytes -= (long) src->pub.bytes_in_buffer;
(void) fill_input_buffer(cinfo);
/* note we assume that fill_input_buffer will never return FALSE,
* so suspension need not be handled.
*/
}
src->pub.next_input_byte += (size_t) num_bytes;
src->pub.bytes_in_buffer -= (size_t) num_bytes;
}
}


/*
* An additional method that can be provided by data source modules is the
* resync_to_restart method for error recovery in the presence of RST markers.
* For the moment, this source module just uses the default resync method
* provided by the JPEG library. That method assumes that no backtracking
* is possible.
*/


/*
* Terminate source --- called by jpeg_finish_decompress
* after all data has been read. Often a no-op.
*
* NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
* application must deal with any cleanup that should happen even
* for error exit.
*/

METHODDEF(void)
term_source (j_decompress_ptr cinfo)
{
/* no work necessary here */
}


/*
* Prepare for input from a memory buffer.
*/

GLOBAL(void)
jpeg_mem_src (j_decompress_ptr cinfo, const JOCTET * buffer, size_t bufsize)
{
my_src_ptr src;

/* The source object is made permanent so that a series of JPEG images
* can be read from a single buffer by calling jpeg_mem_src
* only before the first one.
* This makes it unsafe to use this manager and a different source
* manager serially with the same JPEG object. Caveat programmer.
*/
if (cinfo->src == NULL) { /* first time for this JPEG object? */
cinfo->src = (struct jpeg_source_mgr *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
sizeof(my_source_mgr));
}

src = (my_src_ptr) cinfo->src;
src->pub.init_source = init_source;
src->pub.fill_input_buffer = fill_input_buffer;
src->pub.skip_input_data = skip_input_data;
src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
src->pub.term_source = term_source;

src->pub.next_input_byte = buffer;
src->pub.bytes_in_buffer = bufsize;
}


--- NEW FILE jpeg_memsrc.h ---
#include <stdio.h>
#include <jpeglib.h>

void jpeg_mem_src (j_decompress_ptr cinfo, const JOCTET * buffer,
  size_t bufsize);

quake3-1.36-syslibs.patch:
 Makefile                     |   85 ++++++++++++++++++++++++-------------------
 code/jpeg-6b/jmemnobs.c      |   21 ++++++++++
 code/renderer/tr_image_jpg.c |   26 ++++++++++++-
 3 files changed, 95 insertions(+), 37 deletions(-)

--- NEW FILE quake3-1.36-syslibs.patch ---
diff -up quake3-1.36/code/jpeg-6b/jmemnobs.c.syslibs quake3-1.36/code/jpeg-6b/jmemnobs.c
--- quake3-1.36/code/jpeg-6b/jmemnobs.c.syslibs	2010-05-12 20:55:03.000000000 +0200
+++ quake3-1.36/code/jpeg-6b/jmemnobs.c	2010-05-13 13:11:58.000000000 +0200
@@ -17,11 +17,26 @@
 
 #include "../renderer/tr_local.h"
 
+#ifdef USE_SYSTEM_JPEG
+#include <stdio.h>
+#include <stdlib.h>
+#include <jpeglib.h>
+
+#undef GLOBAL
+#define GLOBAL(x) x
+#define FAR
+
+typedef void * backing_store_ptr;
+
+#else
+
 #define JPEG_INTERNALS
 #include "jinclude.h"
 #include "jpeglib.h"
 #include "jmemsys.h"		/* import the system-dependent declarations */
 
+#endif
+
 /*
  * Memory allocation and freeing are controlled by the regular library
  * routines ri.Malloc() and ri.Free().
@@ -83,7 +98,13 @@ GLOBAL(void)
 jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info,
 			 long total_bytes_needed)
 {
+#ifdef USE_SYSTEM_JPEG
+  fprintf(stderr,
+    "jmemnobs.c: jpeg_open_backing_store() call, this should never happen!\n");
+  exit(1);
+#else
   ERREXIT(cinfo, JERR_NO_BACKING_STORE);
+#endif
 }
 
 
diff -up quake3-1.36/code/renderer/tr_image_jpg.c.syslibs quake3-1.36/code/renderer/tr_image_jpg.c
--- quake3-1.36/code/renderer/tr_image_jpg.c.syslibs	2010-05-12 20:55:06.000000000 +0200
+++ quake3-1.36/code/renderer/tr_image_jpg.c	2010-05-13 14:02:09.000000000 +0200
@@ -30,8 +30,13 @@ Foundation, Inc., 51 Franklin St, Fifth 
  * You may also wish to include "jerror.h".
  */
 
+#ifdef USE_SYSTEM_JPEG
+#include <jpeglib.h>
+#include "jpeg_memsrc.h"
+#else
 #define JPEG_INTERNALS
 #include "../jpeg-6b/jpeglib.h"
+#endif
 
 void R_LoadJPG( const char *filename, unsigned char **pic, int *width, int *height ) {
   /* This struct contains the JPEG decompression parameters and pointers to
@@ -62,6 +67,10 @@ void R_LoadJPG( const char *filename, un
 		void *v;
 	} fbuffer;
   byte  *buf;
+#ifdef USE_SYSTEM_JPEG
+   int i,j;
+   byte *inptr, *outptr;
+#endif
 
   /* In this example we want to open the input file before doing anything else,
    * so that the setjmp() error recovery below can assume the file is open.
@@ -131,7 +140,7 @@ void R_LoadJPG( const char *filename, un
   }
 
   memcount = pixelcount * 4;
-  row_stride = cinfo.output_width * cinfo.output_components;
+  row_stride = cinfo.output_width * 4;
 
   out = ri.Malloc(memcount);
 
@@ -152,6 +161,21 @@ void R_LoadJPG( const char *filename, un
 	buf = ((out+(row_stride*cinfo.output_scanline)));
 	buffer = &buf;
     (void) jpeg_read_scanlines(&cinfo, buffer, 1);
+#ifdef USE_SYSTEM_JPEG
+    /* we have RGB data, we need to expand this out to ARGB */
+    inptr = buf + cinfo.output_width * 3 - 1;
+    outptr = buf + row_stride - 1;
+
+    for (i = 0; i < cinfo.output_width; i++) {
+      /* endian dependent? maybe for big endian this must be done after the
+         color/pixel copy? */
+      *outptr-- = 255;
+      for (j = 0; j < 3; j++) {
+        JOCTET color = *inptr--;
+        *outptr-- = color;
+      }
+    }
+#endif
   }
   
   buf = out;
diff -up quake3-1.36/Makefile.syslibs quake3-1.36/Makefile
--- quake3-1.36/Makefile.syslibs	2010-05-12 20:55:16.000000000 +0200
+++ quake3-1.36/Makefile	2010-05-13 12:58:08.000000000 +0200
@@ -107,6 +107,10 @@ ifndef GENERATE_DEPENDENCIES
 GENERATE_DEPENDENCIES=1
 endif
 
+ifndef USE_SYSTEM_JPEG
+USE_SYSTEM_JPEG=1
+endif
+
 ifndef USE_OPENAL
 USE_OPENAL=1
 endif
@@ -257,11 +261,14 @@ ifeq ($(PLATFORM),linux)
   endif
   endif
 
-  BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-    -pipe -DUSE_ICON
+  BASE_CFLAGS = -DUSE_ICON $(shell sdl-config --cflags)
   CLIENT_CFLAGS = $(SDL_CFLAGS)
   SERVER_CFLAGS =
 
+  ifeq ($(USE_SYSTEM_JPEG),1)
+    BASE_CFLAGS += -DUSE_SYSTEM_JPEG=1 -ljpeg
+  endif
+
   ifeq ($(USE_OPENAL),1)
     CLIENT_CFLAGS += -DUSE_OPENAL
     ifeq ($(USE_OPENAL_DLOPEN),1)
@@ -1391,41 +1398,7 @@ Q3OBJ = \
   $(B)/client/l_script.o \
   $(B)/client/l_struct.o \
   \
-  $(B)/client/jcapimin.o \
-  $(B)/client/jcapistd.o \
-  $(B)/client/jccoefct.o  \
-  $(B)/client/jccolor.o \
-  $(B)/client/jcdctmgr.o \
-  $(B)/client/jchuff.o   \
-  $(B)/client/jcinit.o \
-  $(B)/client/jcmainct.o \
-  $(B)/client/jcmarker.o \
-  $(B)/client/jcmaster.o \
-  $(B)/client/jcomapi.o \
-  $(B)/client/jcparam.o \
-  $(B)/client/jcphuff.o \
-  $(B)/client/jcprepct.o \
-  $(B)/client/jcsample.o \
-  $(B)/client/jdapimin.o \
-  $(B)/client/jdapistd.o \
-  $(B)/client/jdatasrc.o \
-  $(B)/client/jdcoefct.o \
-  $(B)/client/jdcolor.o \
-  $(B)/client/jddctmgr.o \
-  $(B)/client/jdhuff.o \
-  $(B)/client/jdinput.o \
-  $(B)/client/jdmainct.o \
-  $(B)/client/jdmarker.o \
-  $(B)/client/jdmaster.o \
-  $(B)/client/jdpostct.o \
-  $(B)/client/jdsample.o \
-  $(B)/client/jdtrans.o \
-  $(B)/client/jerror.o \
-  $(B)/client/jfdctflt.o \
-  $(B)/client/jidctflt.o \
-  $(B)/client/jmemmgr.o \
   $(B)/client/jmemnobs.o \
-  $(B)/client/jutils.o \
   \
   $(B)/client/tr_animation.o \
   $(B)/client/tr_backend.o \
@@ -1464,6 +1437,46 @@ Q3OBJ = \
   $(B)/client/con_log.o \
   $(B)/client/sys_main.o
 
+ifneq ($(USE_SYSTEM_JPEG),1)
+  Q3OBJ += \
+    $(B)/client/jcapimin.o \
+    $(B)/client/jcapistd.o \
+    $(B)/client/jccoefct.o  \
+    $(B)/client/jccolor.o \
+    $(B)/client/jcdctmgr.o \
+    $(B)/client/jchuff.o   \
+    $(B)/client/jcinit.o \
+    $(B)/client/jcmainct.o \
+    $(B)/client/jcmarker.o \
+    $(B)/client/jcmaster.o \
+    $(B)/client/jcomapi.o \
+    $(B)/client/jcparam.o \
+    $(B)/client/jcphuff.o \
+    $(B)/client/jcprepct.o \
+    $(B)/client/jcsample.o \
+    $(B)/client/jdapimin.o \
+    $(B)/client/jdapistd.o \
+    $(B)/client/jdatasrc.o \
+    $(B)/client/jdcoefct.o \
+    $(B)/client/jdcolor.o \
+    $(B)/client/jddctmgr.o \
+    $(B)/client/jdhuff.o \
+    $(B)/client/jdinput.o \
+    $(B)/client/jdmainct.o \
+    $(B)/client/jdmarker.o \
+    $(B)/client/jdmaster.o \
+    $(B)/client/jdpostct.o \
+    $(B)/client/jdsample.o \
+    $(B)/client/jdtrans.o \
+    $(B)/client/jerror.o \
+    $(B)/client/jfdctflt.o \
+    $(B)/client/jidctflt.o \
+    $(B)/client/jmemmgr.o \
+    $(B)/client/jutils.o
+else
+  Q3OBJ += $(B)/client/jpeg_memsrc.o
+endif
+
 ifeq ($(ARCH),i386)
   Q3OBJ += \
     $(B)/client/snd_mixa.o \


Index: quake3.spec
===================================================================
RCS file: /cvs/pkgs/rpms/quake3/devel/quake3.spec,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -p -r1.15 -r1.16
--- quake3.spec	21 Jan 2010 09:30:02 -0000	1.15
+++ quake3.spec	13 May 2010 13:11:34 -0000	1.16
@@ -1,6 +1,6 @@
 Name:           quake3
 Version:        1.36
-Release:        6%{?dist}
+Release:        7.svn1783%{?dist}
 Summary:        Quake 3 Arena engine (ioquake3 version)
 Group:          Amusements/Games
 License:        GPLv2+
@@ -14,7 +14,7 @@ URL:            http://ioquake3.org/
 # rm -fr code/tools/lcc
 # popd
 # tar cvfj %{name}-%{version}.tar.bz2 %{name}-%{version}
-Source0:        %{name}-%{version}.tar.bz2
+Source0:        %{name}-%{version}-svn1783.tar.bz2
 Source1:        %{name}-demo.sh
 Source2:        %{name}.autodlrc
 Source3:        %{name}.desktop
@@ -29,13 +29,13 @@ Source11:       worldofpadman.sh
 Source12:       worldofpadman.autodlrc
 Source13:       worldofpadman.desktop
 Source14:       wop.png
-Patch0:         quake3-1.34-syslibs.patch
+Source15:       jpeg_memsrc.h
+Source16:       jpeg_memsrc.c
+Patch0:         quake3-1.36-syslibs.patch
 Patch2:         quake3-1.34-fix-empty-fs_game-from-server.patch
 Patch3:         quake3-1.34-dont-ask-openarena-cdkey.patch
 Patch4:         quake3-1.34-no-pak0-check.patch
 Patch5:         quake3-1.34-rc4-demo-pak.patch
-# http://bugzilla.icculus.org/show_bug.cgi?id=4331
-Patch6:         quake3-1.36-botlib-strcpy-abuse.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  SDL-devel libXt-devel openal-soft-devel libjpeg-devel
 BuildRequires:  speex-devel libvorbis-devel curl-devel desktop-file-utils
@@ -137,7 +137,9 @@ Padman menu entry, which will automatica
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
-%patch6 -p1
+
+# Add jpeg_memsrc
+cp -p %{SOURCE15} %{SOURCE16} ./code/renderer/
 
 
 %build
@@ -270,6 +272,10 @@ fi
 
 
 %changelog
+* Wed May 12 2010 Xavier Lamien <laxathom at fedoraproject.org> - 1.36-7.svn1783
+- Update release to svn revision (r1783).
+- Remove botlib-strcpy-abuse patch (added upstream).
+
 * Thu Jan 21 2010 Hans de Goede <hdegoede at redhat.com> 1.36-6
 - Update (fix) autodlrc mirror URL's (#557252)
 



More information about the scm-commits mailing list