# HG changeset patch # User John W. Eaton # Date 1269977079 14400 # Node ID a9649f994b073ba2bfca7d24d70373becb4b949e # Parent f261f936bf36b74f1750e10c1ba435b6ee484b7e avoid segfault in string_vector constructor diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2010-03-30 John W. Eaton + + * str-vec.cc (string_vector::string_vector (const char * const *)): + Create empty string_vector object if arg is NULL. + 2010-03-29 Jaroslav Hajek * idx-vector.cc (idx_vector::raw): New method. diff --git a/liboctave/str-vec.cc b/liboctave/str-vec.cc --- a/liboctave/str-vec.cc +++ b/liboctave/str-vec.cc @@ -80,10 +80,13 @@ { octave_idx_type n = 0; - const char * const *t = s; + if (s) + { + const char * const *t = s; - while (*t++) - n++; + while (*t++) + n++; + } resize (n);