apfeltee / clearsilver

Automatically exported from code.google.com/p/clearsilver
Other
1 stars 0 forks source link

crash in hdf_copy if src==NULL #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
patch:

=====
static NEOERR * _copy_nodes (HDF *dest, HDF *src)
{
  NEOERR *err = STATUS_OK;
  HDF *dt, *st;
  HDF_ATTR *attr_copy;

+  if (src == NULL)
+    return STATUS_OK;
  st = src->child;
  while (st != NULL)
  {
    err = _copy_attr(&attr_copy, st->attr);
=====

Original issue reported on code.google.com by msink.p...@gmail.com on 26 Sep 2012 at 11:48

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I think this is an error of end-user, not of clearsilver.

Documentation for hdf_copy says:
"hdf_copy is a deep copy of an HDF tree pointed to by
src to the named node of dest. dest and src need not be
part of the same data set"

there isnt something like "if src is NULL, ..."

Original comment by dedlegp...@gmail.com on 8 Dec 2012 at 8:08

GoogleCodeExporter commented 9 years ago
If all other functions, if src is NULL - function does nothing and returns, and 
only in hdf_copy application crashed in NULL pointer dereference handler.
I think it should be consistent with other functions - if source is NULL, do 
nothing.

Original comment by msink.p...@gmail.com on 14 Dec 2012 at 7:36