File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ impl ConfigurationString {
128
128
/// # Returns
129
129
///
130
130
/// An iterator over bytes.
131
- pub fn parse_bytes_from_hex ( hex : & str ) -> impl Iterator < Item = u8 > {
131
+ pub fn parse_bytes_from_hex ( hex : & str ) -> impl DoubleEndedIterator < Item = u8 > {
132
132
hex. as_bytes ( ) . chunks ( 2 ) . map ( |chunk| {
133
133
let chunk = str:: from_utf8 ( chunk) . unwrap_or_default ( ) ;
134
134
u8:: from_str_radix ( chunk, 16 ) . unwrap_or_default ( )
@@ -237,8 +237,11 @@ impl FromStr for ConfigurationString {
237
237
}
238
238
_ => return Err ( ParseError :: BlockName ) ,
239
239
} ;
240
+ // The uefi specification declares `VALUE` as being a "number" of arbitrary length.
241
+ // And numbers have to be endianness-corrected. Thus, the bytes represented by a value's
242
+ // hex string of arbitrary length have to be reversed to account for that weird encoding.
240
243
let value = match splitter. next ( ) {
241
- Some ( ( "VALUE" , Some ( data) ) ) => Self :: parse_bytes_from_hex ( data) . collect ( ) ,
244
+ Some ( ( "VALUE" , Some ( data) ) ) => Self :: parse_bytes_from_hex ( data) . rev ( ) . collect ( ) ,
242
245
_ => return Err ( ParseError :: BlockConfig ) ,
243
246
} ;
244
247
You can’t perform that action at this time.
0 commit comments