Skip to content

jq: parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 1, column 65 #373

Closed

Description

@vt-alt

Perhaps misformatted json output:

cpu_features-0.9.0$ /usr/bin/list_cpu_features --json | jq .
jq: parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 1, column 65
cpu_features-0.9.0$ /usr/bin/list_cpu_features --json | head -c66 | xxd
00000000: 7b22 6172 6368 223a 2278 3836 222c 2262  {"arch":"x86","b
00000010: 7261 6e64 223a 2249 6e74 656c 2852 2920  rand":"Intel(R)
00000020: 436f 7265 2854 4d29 2069 392d 3130 3930  Core(TM) i9-1090
00000030: 3020 4350 5520 4020 322e 3830 4748 7a06  0 CPU @ 2.80GHz.
00000040: 222c                                     ",

This is ^F (0x06) char in brand string.

Activity

  1. added
    bug
    on Dec 9, 2024
  2. self-assigned this
    on Dec 9, 2024
  3. gchatelet commented on Dec 9, 2024

    @gchatelet
    Collaborator

    @vt-alt would you be able to run cpuid -1 -r and send us the resulting data?

  4. vt-alt commented on Dec 9, 2024

    @vt-alt
    Author
    $ cpuid -1 -r
    CPU:
       0x00000000 0x00: eax=0x00000016 ebx=0x756e6547 ecx=0x6c65746e edx=0x49656e69
       0x00000001 0x00: eax=0x000a0655 ebx=0x0d200800 ecx=0x7ffafbff edx=0xbfebfbff
       0x00000002 0x00: eax=0x76036301 ebx=0x00f0b5ff ecx=0x00000000 edx=0x00c30000
       0x00000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x00000004 0x00: eax=0x3c004121 ebx=0x01c0003f ecx=0x0000003f edx=0x00000000
       0x00000004 0x01: eax=0x3c004122 ebx=0x01c0003f ecx=0x0000003f edx=0x00000000
       0x00000004 0x02: eax=0x3c004143 ebx=0x00c0003f ecx=0x000003ff edx=0x00000000
       0x00000004 0x03: eax=0x3c07c163 ebx=0x03c0003f ecx=0x00004fff edx=0x00000006
       0x00000004 0x04: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x00000005 0x00: eax=0x00000040 ebx=0x00000040 ecx=0x00000003 edx=0x11142120
       0x00000006 0x00: eax=0x000027f7 ebx=0x00000002 ecx=0x00000009 edx=0x00000000
       0x00000007 0x00: eax=0x00000000 ebx=0x029c67af ecx=0x40000018 edx=0xbc000600
       0x00000008 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x00000009 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x0000000a 0x00: eax=0x07300404 ebx=0x00000000 ecx=0x00000000 edx=0x00000603
       0x0000000b 0x00: eax=0x00000001 ebx=0x00000002 ecx=0x00000100 edx=0x0000000d
       0x0000000b 0x01: eax=0x00000005 ebx=0x00000014 ecx=0x00000201 edx=0x0000000d
       0x0000000b 0x02: eax=0x00000000 ebx=0x00000000 ecx=0x00000002 edx=0x0000000d
       0x0000000c 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x0000000d 0x00: eax=0x0000021f ebx=0x00000a88 ecx=0x00000a88 edx=0x00000000
       0x0000000d 0x01: eax=0x0000000f ebx=0x000003c8 ecx=0x00000100 edx=0x00000000
       0x0000000d 0x02: eax=0x00000100 ebx=0x00000240 ecx=0x00000000 edx=0x00000000
       0x0000000d 0x03: eax=0x00000040 ebx=0x000003c0 ecx=0x00000000 edx=0x00000000
       0x0000000d 0x04: eax=0x00000040 ebx=0x00000400 ecx=0x00000000 edx=0x00000000
       0x0000000d 0x08: eax=0x00000080 ebx=0x00000000 ecx=0x00000001 edx=0x00000000
       0x0000000d 0x09: eax=0x00000008 ebx=0x00000a80 ecx=0x00000000 edx=0x00000000
       0x0000000e 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x0000000f 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x00000010 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x00000011 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x00000012 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x00000012 0x01: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x00000012 0x02: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x00000013 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x00000014 0x00: eax=0x00000001 ebx=0x0000000f ecx=0x00000007 edx=0x00000000
       0x00000014 0x01: eax=0x02490002 ebx=0x003f3fff ecx=0x00000000 edx=0x00000000
       0x00000015 0x00: eax=0x00000002 ebx=0x000000ea ecx=0x00000000 edx=0x00000000
       0x00000016 0x00: eax=0x00000af0 ebx=0x00001450 ecx=0x00000064 edx=0x00000000
       0x20000000 0x00: eax=0x00000af0 ebx=0x00001450 ecx=0x00000064 edx=0x00000000
       0x80000000 0x00: eax=0x80000008 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x80000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000121 edx=0x2c100800
       0x80000002 0x00: eax=0x65746e49 ebx=0x2952286c ecx=0x726f4320 edx=0x4d542865
       0x80000003 0x00: eax=0x39692029 ebx=0x3930312d ecx=0x43203030 edx=0x40205550
       0x80000004 0x00: eax=0x382e3220 ebx=0x7a484730 ecx=0x00000000 edx=0x00000000
       0x80000005 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x80000006 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x01006040 edx=0x00000000
       0x80000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000100
       0x80000008 0x00: eax=0x00003027 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
       0x80860000 0x00: eax=0x00000af0 ebx=0x00001450 ecx=0x00000064 edx=0x00000000
       0xc0000000 0x00: eax=0x00000af0 ebx=0x00001450 ecx=0x00000064 edx=0x00000000
    
  5. gchatelet commented on Dec 10, 2024

    @gchatelet
    Collaborator

    Ok so Brand String is stored in

       0x80000002 0x00: eax=0x65746e49 ebx=0x2952286c ecx=0x726f4320 edx=0x4d542865
       0x80000003 0x00: eax=0x39692029 ebx=0x3930312d ecx=0x43203030 edx=0x40205550
       0x80000004 0x00: eax=0x382e3220 ebx=0x7a484730 ecx=0x00000000 edx=0x00000000
    

    Because Little Endian we have to swap integers in each register which gives the following hex sequence

    496e7465 6c285229 20436f72 6528544d 29206939 2d313039 30302043 50552040 20322e38 3047487a 00000000 00000000
    

    0x06 is clearly not ending this sequence so this is a bug for sure.
    Let me dig into this.

  6. added 5 commits that reference this issue on Dec 10, 2024
    3b23cdc
    7fdab09
    c0f0437
    a2b9437
    3a989ba
  7. vt-alt commented on Dec 17, 2024

    @vt-alt
    Author

    Thank you!

  8. gchatelet commented on Dec 17, 2024

    @gchatelet
    Collaborator

    It took much longer than I thought but I tested it and jq is happy :)

  9. vt-alt commented on Dec 17, 2024

    @vt-alt
    Author

    I tested too and it's good!

  10. added this to the v0.10.0 milestone on May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions