Re: [PATCH spice-gtk 3/4] util: add unix2dos and dos2unix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----- Mensaje original -----
> Hi,
> 
> On 08/24/2013 02:17 PM, Marc-André Lureau wrote:
> 
> <snip>
> 
> >>> +
> >>> +    if (!g_utf8_validate(str, len, NULL)) {
> >>> +        g_set_error_literal(error, G_CONVERT_ERROR,
> >>> +                            G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
> >>> +                            "Invalid byte sequence in conversion
> >>> input");
> >>> +        return -1;
> >>> +    }
> >>
> >>
> >> And once you simply treat this as a regular C-string without worrying
> >> about multi-byte encodings you can also drop this.
> >
> > Actually, during implementation, I have encountered/produced invalid
> > utf8 that will break later on in gtk+, so I prefer to validate the
> > production.
> 
> Thinking more about this, if we want to do utf-8 validation, it should not
> be done here, but rather in gtk/channel-main.c, since this code only gets
> called in certain guest-line-end + direction cases, and if we want to do
> utf-8 validation we should always do it.

Perhaps, although the difference is that here we do parse/modify the string,
so it's important to check we don't produce garbage.

gtk/channel-main.c is a pass-through, validation is left to the
other end at this point.
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]