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 {
128128 /// # Returns
129129 ///
130130 /// 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 > {
132132 hex. as_bytes ( ) . chunks ( 2 ) . map ( |chunk| {
133133 let chunk = str:: from_utf8 ( chunk) . unwrap_or_default ( ) ;
134134 u8:: from_str_radix ( chunk, 16 ) . unwrap_or_default ( )
@@ -237,8 +237,11 @@ impl FromStr for ConfigurationString {
237237 }
238238 _ => return Err ( ParseError :: BlockName ) ,
239239 } ;
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.
240243 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 ( ) ,
242245 _ => return Err ( ParseError :: BlockConfig ) ,
243246 } ;
244247
You can’t perform that action at this time.
0 commit comments