[lkml]   [2013]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 10/18] Do proper conversion from UTF-16 to UTF-8
On 09/22/2013 04:07 PM, Roy Franz wrote:
> On Sun, Sep 22, 2013 at 3:54 PM, H. Peter Anvin <> wrote:
>> Sorry this version is broken and doesn't even compile due to remaining options_size references.
> I compiled and tested this series on both x86_64 (using OVMF) and on
> the ARM simulator. I just doubled checked
> my kernel .config to verify this was not being omitted and I'm pretty
> sure this doesn't have any compilation problems.
> I did make a few changes to get the untested version you sent out to
> compile, but they all seemed to be straightforward typo type fixes.
> I'll gladly address any defects in this patch, but I don't see an
> compilation problems.

Ah yes, I see now... you fixed up the compile problem but did so

int load_options_size = image->load_options_size / 2; /* ASCII */

This is a number of UTF-16 chars, the comment is completely wrong;

- while (*s2 && *s2 != '\n' && options_size <
load_options_size) {
+ while (*s2 && *s2 != '\n' && options_bytes <
load_options_size) {
+ options_bytes += efi_utf8_bytes(*s2);
- options_size++;
+ options_chars = s2 - options;

You can't compare options_bytes against load_options_size; the latter
being a UTF-16 shortword count.

So the loop really needs to update options_chars in the loop to compare
it against load_options_size:

while (*s2 && *s2 != '\n' && options_chars < load_options_size) {
options_bytes += efi_utf8_bytes(*s2++);


 \ /
  Last update: 2013-09-23 02:41    [W:0.158 / U:3.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site