[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9746: We don't protect the stack an
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9746: We don't protect the stack any more. |
Date: |
Mon, 15 Sep 2008 14:02:15 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9746
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2008-09-15 14:02:15 +0200
message:
We don't protect the stack any more.
Clarify std::bad_alloc handling.
modified:
libbase/image.cpp
libbase/image.h
libcore/array.cpp
libcore/as_object.cpp
libcore/asobj/AsBroadcaster.cpp
libcore/asobj/String_as.cpp
libcore/vm/ASHandlers.cpp
------------------------------------------------------------
revno: 9740.2.1
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-09-15 13:46:35 +0200
message:
Drop stack-smashing assertions.
Log error, add comment on bad_alloc exception. ImageBase ctor can only
throw std::bad_alloc.
modified:
libbase/image.cpp
libbase/image.h
libcore/array.cpp
libcore/as_object.cpp
libcore/asobj/AsBroadcaster.cpp
libcore/asobj/String_as.cpp
libcore/vm/ASHandlers.cpp
=== modified file 'libbase/image.cpp'
--- a/libbase/image.cpp 2008-09-15 09:05:23 +0000
+++ b/libbase/image.cpp 2008-09-15 11:46:35 +0000
@@ -260,7 +260,10 @@
}
catch (std::bad_alloc& e)
{
- return im;
+ // This should be caught here because ~JpegImageInput can also
throw
+ // an exception on stack unwinding and this confuses remote
catchers.
+ log_error("Out of memory while trying to create %dx%d image",
width, height);
+ return im;
}
for (size_t i = 0; i < height; ++i)
=== modified file 'libbase/image.h'
--- a/libbase/image.h 2008-08-18 23:53:04 +0000
+++ b/libbase/image.h 2008-09-15 11:46:35 +0000
@@ -59,7 +59,7 @@
{
public:
- ImageBase(const ImageBase& o)
+ ImageBase(const ImageBase& o) throw (std::bad_alloc)
:
_type(o._type),
_size(o.size()),
=== modified file 'libcore/array.cpp'
--- a/libcore/array.cpp 2008-09-12 10:37:09 +0000
+++ b/libcore/array.cpp 2008-09-15 11:46:35 +0000
@@ -365,19 +365,11 @@
as_value cmp_method(&_comp);
as_value ret(0);
-#ifndef NDEBUG
- size_t prevStackSize = _env.stack_size();
-#endif
-
- std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value>
);
- args->push_back(b);
- args->push_back(a);
+ std::auto_ptr< std::vector<as_value> > args ( new
std::vector<as_value> );
+ args->push_back(b);
+ args->push_back(a);
ret = call_method(cmp_method, &_env, _object, args);
-#ifndef NDEBUG
- assert(prevStackSize == _env.stack_size());
-#endif
-
return (*_zeroCmp)(ret.to_int());
}
};
=== modified file 'libcore/as_object.cpp'
--- a/libcore/as_object.cpp 2008-09-12 10:37:09 +0000
+++ b/libcore/as_object.cpp 2008-09-15 11:46:35 +0000
@@ -1313,20 +1313,12 @@
as_environment env(_vm);
-#ifndef NDEBUG
- size_t origStackSize = env.stack_size();
-#endif
-
std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value>
);
args->push_back(arg0);
args->push_back(arg1);
ret = call_method(method, &env, this, args);
-#ifndef NDEBUG
- assert(origStackSize == env.stack_size());
-#endif
-
return ret;
}
@@ -1344,10 +1336,6 @@
as_environment env(_vm);
-#ifndef NDEBUG
- size_t origStackSize = env.stack_size();
-#endif
-
std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value>
);
args->push_back(arg0);
args->push_back(arg1);
@@ -1355,10 +1343,6 @@
ret = call_method(method, &env, this, args);
-#ifndef NDEBUG
- assert(origStackSize == env.stack_size());
-#endif
-
return ret;
}
@@ -1377,10 +1361,6 @@
as_environment env(_vm);
-#ifndef NDEBUG
- size_t origStackSize = env.stack_size();
-#endif
-
std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value>
);
args->push_back(arg0);
args->push_back(arg1);
@@ -1389,10 +1369,6 @@
ret = call_method(method, &env, this, args);
-#ifndef NDEBUG
- assert(origStackSize == env.stack_size());
-#endif
-
return ret;
}
@@ -1514,10 +1490,6 @@
try {
as_environment env(VM::get()); // TODO: get VM in some other
way
-#ifndef NDEBUG
- size_t origStackSize = env.stack_size();
-#endif
-
std::auto_ptr< std::vector<as_value> > args ( new
std::vector<as_value> );
args->push_back(_propname);
args->push_back(oldval);
@@ -1528,10 +1500,6 @@
as_value ret = _func->call(fn);
-#ifndef NDEBUG
- assert(origStackSize == env.stack_size());
-#endif
-
_executing = false;
return ret;
=== modified file 'libcore/asobj/AsBroadcaster.cpp'
--- a/libcore/asobj/AsBroadcaster.cpp 2008-08-29 14:29:54 +0000
+++ b/libcore/asobj/AsBroadcaster.cpp 2008-09-15 11:46:35 +0000
@@ -83,14 +83,9 @@
if ( method.is_function() )
{
-#ifndef NDEBUG
- size_t oldStackSize = _fn.env().stack_size();
-#endif
_fn.this_ptr = o.get();
method.to_as_function()->call(_fn);
- assert ( _fn.env().stack_size() == oldStackSize );
-
}
++_dispatched;
=== modified file 'libcore/asobj/String_as.cpp'
--- a/libcore/asobj/String_as.cpp 2008-09-03 13:43:22 +0000
+++ b/libcore/asobj/String_as.cpp 2008-09-15 11:46:35 +0000
@@ -842,18 +842,10 @@
}
}
-#ifndef NDEBUG
- size_t prevStackSize = env.stack_size();
-#endif
-
std::auto_ptr< std::vector<as_value> > args ( new std::vector<as_value>
);
args->push_back(val);
boost::intrusive_ptr<as_object> ret = cl->constructInstance(env, args);
-#ifndef NDEBUG
- assert( prevStackSize == env.stack_size());
-#endif
-
return ret;
}
=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2008-09-04 03:08:33 +0000
+++ b/libcore/vm/ASHandlers.cpp 2008-09-15 11:46:35 +0000
@@ -3047,10 +3047,6 @@
//GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
-#ifndef NDEBUG
- size_t stackSize = env.stack_size();
-#endif
-
as_value v1 = env.top(0);
as_value v2 = env.top(1);
@@ -3068,8 +3064,6 @@
env.top(1));
}
- assert( stackSize == env.stack_size() );
-
#if GNASH_DEBUG
log_debug(_("ActionNewAdd(%s, %s) [primitive conversion done]"),
v1, v2);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9746: We don't protect the stack any more.,
Benjamin Wolsey <=