Skip to content
Snippets Groups Projects
  • Jonathan Schöbel's avatar
    aeca7dd7
    Text: added constructor with initialization · aeca7dd7
    Jonathan Schöbel authored
    The constructor SH_Text_new_from_string accepts a string, with that the
    text is initialized. This can replace the so far needed two calls
    SH_Text_new and SH_Text_append_string.
    
    When writing the test, it was neccessary to simulate an overflow.
    Thereby a bug was detected regarding another overflow test. The bug was,
    that when SIZE_MAX % CHUNK_SIZE == 0 (which is normally true, if 2^n is
    taken as the value for CHUNK_SIZE) there can't be an overflow, so the
    test for an overflow fails. Actually there wasn't a neccesity to check
    for an overflow, as this could easily be bypassed by just allocating the
    requested size instead of the next chunk size, if this would be greater
    then SIZE_MAX.
    aeca7dd7
    History
    Text: added constructor with initialization
    Jonathan Schöbel authored
    The constructor SH_Text_new_from_string accepts a string, with that the
    text is initialized. This can replace the so far needed two calls
    SH_Text_new and SH_Text_append_string.
    
    When writing the test, it was neccessary to simulate an overflow.
    Thereby a bug was detected regarding another overflow test. The bug was,
    that when SIZE_MAX % CHUNK_SIZE == 0 (which is normally true, if 2^n is
    taken as the value for CHUNK_SIZE) there can't be an overflow, so the
    test for an overflow fails. Actually there wasn't a neccesity to check
    for an overflow, as this could easily be bypassed by just allocating the
    requested size instead of the next chunk size, if this would be greater
    then SIZE_MAX.