Branch: Tag:

2017-11-01

2017-11-01 10:58:17 by Arne Goedeke <el@laramies.com>

push_string(): handle OOM errors correctly

make_shared_string() may throw an error in OOM situation. If that
happens here, we will end up having a corrupt svalue on the stack.

3133:      PMOD_EXPORT void push_text( const char *x )   { +  struct pike_string *s = make_shared_string(x);    struct svalue *_sp_ = Pike_sp++;    SET_SVAL_SUBTYPE(*_sp_, 0); -  _sp_->u.string=make_shared_string(x); +  _sp_->u.string=s    debug_malloc_touch(_sp_->u.string);    SET_SVAL_TYPE(*_sp_, PIKE_T_STRING);   }      PMOD_EXPORT void push_static_text( const char *x )   { -  +  struct pike_string *s = make_shared_static_string(x, strlen(x), eightbit);    struct svalue *_sp_ = Pike_sp++;    SET_SVAL_SUBTYPE(*_sp_, 0); -  _sp_->u.string=make_shared_static_string(x, strlen(x), eightbit); +  _sp_->u.string=s;    debug_malloc_touch(_sp_->u.string);    SET_SVAL_TYPE(*_sp_, PIKE_T_STRING);   }