Skip to content

[CRASHER] Indexing an array as though it's a mapping in (s)printf #951

@gesslar

Description

@gesslar

Either of the following will crash FluffOS

string *item = ({ "one", "two" }); printf("%s\n", item["bad_index"])
eval string *item = ({ "one", "two" }); sprintf("%s\n", item["bad_index"])

/u/g/gesslar/CMD_EVAL_TMP_FILE.c line 16: Bad type of index: "string "
  return item["bad_index"] ;
                           ^
/u/g/gesslar/CMD_EVAL_TMP_FILE.c line 16: Bad type of index: "string "
Stack trace (most recent call last):
#26   Object "[0xffffffffffffffff]", at 0xffffffffffffffff, in
#25   Object "./driver", at 0x55c8f7572dbd, in _start
#24   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7fee373aa082, in __libc_start_main
#23   Object "./driver", at 0x55c8f7572d5c, in
#22   Object "./driver", at 0x55c8f76d0b96, in
#21   Object "./driver", at 0x55c8f7583abf, in
#20   Object "./driver", at 0x55c8f759a576, in
#19   Object "./driver", at 0x55c8f759a2b2, in
#18   Object "./driver", at 0x55c8f7671a75, in
#17   Object "./driver", at 0x55c8f766a71d, in
#16   Object "./driver", at 0x55c8f764488c, in
#15   Object "./driver", at 0x55c8f764416f, in
#14   Object "./driver", at 0x55c8f7688999, in
#13   Object "./driver", at 0x55c8f769c8fa, in
#12   Object "./driver", at 0x55c8f7634eb4, in
#11   Object "./driver", at 0x55c8f7688999, in
#10   Object "./driver", at 0x55c8f769ed0f, in
#9    Object "./driver", at 0x55c8f769c8fa, in
#8    Object "./driver", at 0x55c8f7634e79, in
#7    Object "./driver", at 0x55c8f7674cf4, in
#6    Object "./driver", at 0x55c8f768235e, in
#5    Object "./driver", at 0x55c8f7667e4a, in
#4    Object "./driver", at 0x55c8f76673b9, in
#3    Object "./driver", at 0x55c8f76c16a2, in
#2    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7fee37411f99, in
#1    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7fee373fed14, in
#0    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7fee3750e6e5, in
Segmentation fault (Address not mapped to object [0xd0])
Segmentation fault

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions