tags 356324 +patch
thanks
Here's a patch that fixes the error:
--- vbs-1.4.0.orig/src/common/st_net.h
+++ vbs-1.4.0/src/common/st_net.h
@@ -133,4 +133,7 @@
const st_net &_net;
};
+void entry_iovars(st_net::io_list &, st_net::arg_list &);
+void exit_iovars(st_net::io_list &, st_net::arg_list &);
+
#endif // _ST_NET_H
-- END --
The most common warning is "'struct ...' has virtual functions but
non-virtual destructor". This warning appears because deleting an
instance of a derived class through a pointer to a base class has
undefined behaviour if that base class does not have a virtual
destructor. (And this is undefined because there is no way to find the
correct destructor at that point.) I think that this program uses
polymorphic classes in such a way that it will never run into this
problem. But it would be a good idea to check that, and to add either
public virtual or protected non-virtual destructors as appropriate to
guard against the possibility.
Another warning is:
dvbs_lex.c:2524: warning: 'yyunput' defined but not used
This seems like a harmless warning about generated code.
The remaining warnings are:
src/expr/erdwr.cc:29: warning: dereferencing type-punned pointer will
break strict-aliasing rules
src/misc/mrdwr.cc:25: warning: dereferencing type-punned pointer will
break strict-aliasing rules
src/misc/mrdwr.cc:133: warning: dereferencing type-punned pointer will
break strict-aliasing rules
These warn about dangerous casts that should be fixed as follows:
--- vbs-1.4.0.orig/src/expr/erdwr.cc
+++ vbs-1.4.0/src/expr/erdwr.cc
@@ -25,8 +25,9 @@
expr_base *
read_expr::operator()() const
{
- VBSOBJ_EXPR_TYPE type;
- _in >> (int &) type;
+ int type_num = 0;
+ _in >> type_num;
+ VBSOBJ_EXPR_TYPE type = VBSOBJ_EXPR_TYPE(type_num);
long ln;
_in >> ln;
expr_base *expr = 0;
--- vbs-1.4.0.orig/src/misc/mrdwr.cc
+++ vbs-1.4.0/src/misc/mrdwr.cc
@@ -21,8 +21,9 @@
module *
read_module::operator()() const
{
- VBSOBJ_MISC_TYPE type;
- _in >> (int &) type;
+ int type_num = 0;
+ _in >> type_num;
+ VBSOBJ_MISC_TYPE type = VBSOBJ_MISC_TYPE(type_num);
if (type != VBSOBJ_MISC_MODULE)
{
vbs_err.set_data(vbs_error::SE_VBSOBJ, -1);
@@ -129,8 +130,9 @@
port *
read_port::operator()() const
{
- VBSOBJ_MISC_TYPE type;
- _in >> (int &) type;
+ int type_num = 0;
+ _in >> type_num;
+ VBSOBJ_MISC_TYPE type = VBSOBJ_MISC_TYPE(type_num);
if (type != VBSOBJ_MISC_PORT)
{
vbs_err.set_data(vbs_error::SE_VBSOBJ, -1);
-- END --
Also, it appears that these functions never check that extraction from
_in has succeeded. Please check this; if it's true then it's a bug
because a truncated file or I/O error will result in use of
uninitialised variables. (This is why the replacement code in the patch
initialises type_num to 0.)
Ben.
--
Ben Hutchings
It is easier to change the specification to fit the program than vice versa.
Attachment:
signature.asc
Description: This is a digitally signed message part