gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog configure.ac backend/sound_hand...


From: Bastiaan Jacques
Subject: [Gnash-commit] gnash ChangeLog configure.ac backend/sound_hand...
Date: Tue, 25 Jul 2006 19:27:55 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Bastiaan Jacques <bjacques>     06/07/25 19:27:55

Modified files:
        .              : ChangeLog configure.ac 
        backend        : sound_handler_gst.cpp sound_handler_sdl.cpp 
        server         : edit_text_character.cpp sound.cpp 

Log message:
                * configure.ac: The correct option is --enable-plugin, not
                --disable-plugin.
                * backend/sound_handler_gst.cpp: Don't use realloc() on operator
                new-allocated pointers. Do some trivial cleanup.
                * backend/sound_handler_sdl.cpp: Trivially fix warnings.
                * server/edit_text_character.cpp: Likewise.
                * server/sound.cpp: Ensure that the sample rate is in the 
acceptable
                range, to avoid invalid memory accesses.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.515&r2=1.516
http://cvs.savannah.gnu.org/viewcvs/gnash/configure.ac?cvsroot=gnash&r1=1.88&r2=1.89
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_gst.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/sound_handler_sdl.cpp?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sound.cpp?cvsroot=gnash&r1=1.12&r2=1.13

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.515
retrieving revision 1.516
diff -u -b -r1.515 -r1.516
--- ChangeLog   25 Jul 2006 17:16:46 -0000      1.515
+++ ChangeLog   25 Jul 2006 19:27:54 -0000      1.516
@@ -1,3 +1,14 @@
+2006-07-25 Bastiaan Jacques <address@hidden>
+
+       * configure.ac: The correct option is --enable-plugin, not
+       --disable-plugin.
+       * backend/sound_handler_gst.cpp: Don't use realloc() on operator
+       new-allocated pointers. Do some trivial cleanup.
+       * backend/sound_handler_sdl.cpp: Trivially fix warnings.
+       * server/edit_text_character.cpp: Likewise.
+       * server/sound.cpp: Ensure that the sample rate is in the acceptable
+       range, to avoid invalid memory accesses.
+
 2006-07-25 Vitaly Alexeev <address@hidden>
 
        * libbase/log.cpp: small optimization is done

Index: configure.ac
===================================================================
RCS file: /sources/gnash/gnash/configure.ac,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -b -r1.88 -r1.89
--- configure.ac        25 Jul 2006 03:13:17 -0000      1.88
+++ configure.ac        25 Jul 2006 19:27:54 -0000      1.89
@@ -268,7 +268,7 @@
   [case "${enableval}" in
     yes) plugin=yes ;;
     no)  plugin=no ;;
-    *)   AC_MSG_ERROR([bad value ${enableval} for disable-plugin option]) ;;
+    *)   AC_MSG_ERROR([bad value ${enableval} for enable-plugin option]) ;;
   esac],
   plugin=no
 )

Index: backend/sound_handler_gst.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_gst.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- backend/sound_handler_gst.cpp       24 Jul 2006 18:59:40 -0000      1.3
+++ backend/sound_handler_gst.cpp       25 Jul 2006 19:27:54 -0000      1.4
@@ -204,7 +204,7 @@
                   width: 8
                   depth: [ 1, 8 ]
                  signed: { true, false }*/
-                       sounddata->data = static_cast<guint8*>(new 
guint8[data_bytes]);
+                       sounddata->data = new guint8[data_bytes];
                        if (!sounddata->data) { 
                                gnash::log_error("could not allocate space for 
data in soundhandler\n");
                                return -1;
@@ -221,7 +221,7 @@
                   width: 16
                   depth: [ 1, 16 ]
                  signed: { true, false }*/
-                       sounddata->data = static_cast<guint8*>(new 
guint8[data_bytes]);
+                       sounddata->data = new guint8[data_bytes];
                        if (!sounddata->data) { 
                                gnash::log_error("could not allocate space for 
data in soundhandler\n");
                                return -1;
@@ -231,7 +231,7 @@
 
                case FORMAT_MP3:
                //case FORMAT_VORBIS:
-                       sounddata->data = static_cast<guint8*>(new 
guint8[data_bytes]);
+                       sounddata->data = new guint8[data_bytes];
                        if (!sounddata->data) { 
                                gnash::log_error("could not allocate space for 
data in soundhandler\n");
                                return -1;
@@ -257,10 +257,15 @@
                
                if (handle_id >= 0 && handle_id < m_sound_data.size())
                {
-                       m_sound_data[handle_id]->data = 
static_cast<guint8*>(realloc(m_sound_data[handle_id]->data, data_bytes + 
m_sound_data[handle_id]->data_size));
-                       memcpy(m_sound_data[handle_id]->data + 
m_sound_data[handle_id]->data_size, data, data_bytes);
-                       m_sound_data[handle_id]->data_size += data_bytes;
-                       return m_sound_data[handle_id]->data_size - data_bytes;
+                       sound_data* cur_data = m_sound_data[handle_id]->data;
+                       unsigned int cur_data_size = cur_data->data_size;
+                       
+                       // Reallocate the required memory.
+                       delete [] cur_data;
+                       cur_data = new guint8[data_bytes + cur_data_size];
+                       cur_data_size += data_bytes;
+
+                       return cur_data_size - data_bytes;
                }
                return 0;
                // FIXME: if the playback of the stream has already started 
we'll need to update the struct
@@ -282,7 +287,11 @@
                        } else {
                                GST_BUFFER_SIZE(buffer) = 
gstelements->data_size;
                        }
-                       GST_BUFFER_DATA(buffer) = 
static_cast<guint8*>(realloc(GST_BUFFER_DATA(buffer),GST_BUFFER_SIZE(buffer)));
+
+                       unsigned int buf_size = GST_BUFFER_SIZE(buffer);
+
+                       delete [] GST_BUFFER_DATA(buffer);
+                       GST_BUFFER_DATA(buffer) = new guint8[buf_size];
                }
 
                // This shouldn't happen

Index: backend/sound_handler_sdl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/sound_handler_sdl.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- backend/sound_handler_sdl.cpp       24 Jul 2006 18:59:40 -0000      1.13
+++ backend/sound_handler_sdl.cpp       25 Jul 2006 19:27:54 -0000      1.14
@@ -170,7 +170,7 @@
        virtual void    play_sound(int sound_handle, int loop_count, int 
secondOffset, long start_position)
        // Play the index'd sample.
        {
-         if (m_opened && sound_handle >= 0 && sound_handle < (int) 
m_samples.size())
+         if (m_opened && (sound_handle >= 0) && sound_handle < (int) 
m_samples.size())
                {
                        if (m_samples[sound_handle])
                        {
@@ -197,7 +197,8 @@
        virtual int     get_volume(int sound_handle)
        {
                int previous_volume = 100;
-               if (m_opened && sound_handle >= 0 && sound_handle < 
m_samples.size())
+               if (m_opened && (sound_handle >= 0) && 
+                   (unsigned int) sound_handle < m_samples.size())
                {
                        //      if you passed a negative value for volume then
                        //      this volume is still the current volume for the 
chunk
@@ -208,7 +209,8 @@
 
        virtual void    set_volume(int sound_handle, int volume)
        {
-               if (m_opened && sound_handle >= 0 && sound_handle < 
m_samples.size())
+               if (m_opened && sound_handle >= 0 && 
+                   (unsigned int) sound_handle < m_samples.size())
                {
                        int vol = (MIX_MAX_VOLUME / 100) * volume;
                        Mix_VolumeChunk(m_samples[sound_handle], vol);
@@ -217,7 +219,8 @@
        
        virtual void    stop_sound(int sound_handle)
        {
-               if (m_opened && sound_handle >= 0 && sound_handle < 
m_samples.size())
+               if (m_opened && sound_handle >= 0 && 
+                   (unsigned int) sound_handle < m_samples.size())
                {
                        for (int i = 0; i < MIX_CHANNELS; i++)
                        {

Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/edit_text_character.cpp      25 Jul 2006 12:53:41 -0000      1.8
+++ server/edit_text_character.cpp      25 Jul 2006 19:27:55 -0000      1.9
@@ -176,7 +176,7 @@
                                        break;
 
                                case key::DELETEKEY:
-                                       if (s.size() > m_cursor)
+                                       if (s.size() > (unsigned int)m_cursor)
                                        {
                                                s.erase(m_cursor, 1);
                                                set_text_value(s.c_str());

Index: server/sound.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sound.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/sound.cpp    24 Jul 2006 18:59:40 -0000      1.12
+++ server/sound.cpp    25 Jul 2006 19:27:55 -0000      1.13
@@ -395,6 +395,12 @@
                int     data_bytes = 0;
                unsigned char*  data = NULL;
 
+               if (! (sample_rate >= 0 && sample_rate <= 3))
+               {
+                       gnash::log_error("Bad sample rate read from SWF 
header.\n");
+                       return;
+               }
+
                if (format == sound_handler::FORMAT_ADPCM)
                {
                        // Uncompress the ADPCM before handing data to host.
@@ -511,6 +517,12 @@
        {
                int     data_bytes = 0;
 
+               if (! (sample_rate >= 0 && sample_rate <= 3))
+               {
+                       gnash::log_error("Bad sample rate read from SWF 
header.\n");
+                       return;
+               }
+
                int     handler_id = s_sound_handler->create_sound(
                        NULL,
                        data_bytes,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]