[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libbase/jpeg.cpp
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog libbase/jpeg.cpp |
Date: |
Tue, 29 Jan 2008 21:23:45 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/01/29 21:23:44
Modified files:
. : ChangeLog
libbase : jpeg.cpp
Log message:
don't long jump in the constructor. Fixes bug #22147.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5518&r2=1.5519
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/jpeg.cpp?cvsroot=gnash&r1=1.22&r2=1.23
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5518
retrieving revision 1.5519
diff -u -b -r1.5518 -r1.5519
--- ChangeLog 29 Jan 2008 19:40:14 -0000 1.5518
+++ ChangeLog 29 Jan 2008 21:23:44 -0000 1.5519
@@ -1,5 +1,7 @@
2008-01-29 Sandro Santilli <address@hidden>
+ * libbase/jpeg.cpp: don't long jump in the constructor.
+ Fixes bug #22147.
* server/fill_style.cpp (create_gradient_bitmap): fix a probably
unmeant float to int conversion.
* server/asobj/LocalConnection.cpp: remove duplicated
Index: libbase/jpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/jpeg.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- libbase/jpeg.cpp 14 Dec 2007 12:35:17 -0000 1.22
+++ libbase/jpeg.cpp 29 Jan 2008 21:23:44 -0000 1.23
@@ -325,8 +325,7 @@
enum SWF_DEFINE_BITS_JPEG2_HEADER_ONLY { SWF_JPEG2_HEADER_ONLY
};
/// \brief
- /// Constructor. Read the header data from in, and
- /// prepare to read data.
+ /// Constructor.
//
/// @param in
/// The stream to read from. Ownership specified by
@@ -343,45 +342,15 @@
m_cinfo.err = &m_jerr;
m_cinfo.client_data = this;
- if ( setjmp(_jmpBuf) )
- {
- std::stringstream ss;
- ss << "Internal jpeg error: " << _errorOccurred;
- throw gnash::ParserException(ss.str());
- }
-
// Initialize decompression object.
jpeg_create_decompress(&m_cinfo);
rw_source_tu_file::setup(&m_cinfo, in, takeOwnership);
- start_image();
}
-
- // The SWF file format stores JPEG images with the
- // encoding tables separate from the image data. This
- // constructor reads the encoding table only and keeps
- // them in this object. You need to call
- // start_image() and finish_image() around any calls
- // to get_width/height/components and read_scanline.
- //
- /// @param in
- /// The stream to read from. Ownership specified by
- /// last argument.
- ///
- /// @param takeOwnership
- /// If true, we take ownership of the input stream.
- ///
- input_tu_file(SWF_DEFINE_BITS_JPEG2_HEADER_ONLY /* e */,
tu_file* in,
- unsigned int maxHeaderBytes, bool
takeOwnership=false)
- :
- m_compressor_opened(false)
+ void readHeader(unsigned int maxHeaderBytes)
{
- setup_jpeg_err(&m_jerr);
- m_cinfo.err = &m_jerr;
- m_cinfo.client_data = this;
-
if ( setjmp(_jmpBuf) )
{
std::stringstream ss;
@@ -389,15 +358,8 @@
throw gnash::ParserException(ss.str());
}
- // Initialize decompression object.
- jpeg_create_decompress(&m_cinfo);
-
- rw_source_tu_file::setup(&m_cinfo, in, takeOwnership);
-
if ( maxHeaderBytes )
{
- unsigned long startPos = in->get_position();
-
// Read the encoding tables.
// TODO: how to limit reads ?
int ret = jpeg_read_header(&m_cinfo, FALSE);
@@ -425,11 +387,6 @@
throw gnash::ParserException(ss.str());
}
- unsigned long endPos = in->get_position();
- if ( endPos - startPos > maxHeaderBytes )
- {
- gnash::log_error("Reading of jpeg
headers went past requested maxHeaderBytes");
- }
}
// Don't start reading any image data!
@@ -474,6 +431,14 @@
{
assert(m_compressor_opened == false);
+ if ( setjmp(_jmpBuf) )
+ {
+ std::stringstream ss;
+ ss << "Internal jpeg error: " << _errorOccurred;
+ throw gnash::ParserException(ss.str());
+ }
+
+
// hack, FIXME
static const int stateReady = 202; /* found SOS,
ready for start_decompress */
while (m_cinfo.global_state != stateReady)
@@ -674,8 +639,10 @@
input*
input::create(tu_file* in, bool takeOwnership)
{
- input* ret = new tu_file_wrappers::input_tu_file(in, takeOwnership);
- return ret;
+ using tu_file_wrappers::input_tu_file;
+ std::auto_ptr<input_tu_file> ret ( new input_tu_file(in, takeOwnership)
);
+ if ( ret.get() ) ret->start_image(); // might throw an exception (I
guess)
+ return ret.release();
}
/*static*/
@@ -683,8 +650,9 @@
input::create_swf_jpeg2_header_only(tu_file* in, unsigned int maxHeaderBytes,
bool takeOwnership)
{
using tu_file_wrappers::input_tu_file;
- input* ret = new input_tu_file(input_tu_file::SWF_JPEG2_HEADER_ONLY,
in, maxHeaderBytes, takeOwnership);
- return ret;
+ std::auto_ptr<input_tu_file> ret ( new input_tu_file(in, takeOwnership)
);
+ if ( ret.get() ) ret->readHeader(maxHeaderBytes); // might throw an
exception
+ return ret.release();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog libbase/jpeg.cpp,
Sandro Santilli <=