[Webkit-unassigned] [Bug 25415] [GTK][ATK] Please implement support for get_text_at_offset

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 24 01:07:10 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=25415


Jan Alonzo <jmalonzo at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #33258|review?                     |review+
               Flag|                            |




--- Comment #51 from Jan Alonzo <jmalonzo at gmail.com>  2009-07-24 01:07:09 PDT ---
(From update of attachment 33258)
>  static gchar* g_substr(const gchar* string, gint start, gint end)
>  {
> -    gsize len = end - start + 1;
> -    gchar* output = static_cast<gchar*>(g_malloc0(len + 1));
> -    return g_utf8_strncpy(output, string +start, len);
> +    gchar* startPtr = g_utf8_offset_to_pointer(string, start);

According to the doc, g_utf8_offset_to_pointer doesn't check if offset is
within the boundaries of string. Can we add a check here?

> +    gsize lenInBytes = g_utf8_offset_to_pointer(string, end) -  startPtr + 1;

Ditto for 'end' and check if startPtr is 0 first. Looks fine otherwise. r=me.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list