pike.git / src / stralloc.c

version» Context lines:

pike.git/src/stralloc.c:750:    tmp2->next=base_table[h2]; /* and re-hash */    base_table[h2]=tmp2;    }    }    }   }      PMOD_EXPORT struct pike_string *debug_begin_wide_shared_string(size_t len, enum size_shift shift)   {    struct pike_string *t = NULL; -  size_t bytes = (len+1) << shift; +  size_t bytes;    ONERROR fe; -  +  +  if ((ptrdiff_t)len < 0 || DO_SIZE_T_ADD_OVERFLOW(len, 1, &bytes) || +  DO_SIZE_T_MUL_OVERFLOW(bytes, 1 << shift, &bytes)) { +  Pike_error("String is too large.\n"); +  } +    #ifdef PIKE_DEBUG    if(d_flag>10)    verify_shared_strings_tables();   #endif   #ifdef PIKE_DEBUG    if (shift > 2)    Pike_fatal("Unsupported string shift: %d\n", shift);   #endif /* PIKE_DEBUG */    t=ba_alloc(&string_allocator);    /* we mark the string as static here, to avoid double free if the