Skip to content

Bug: Crash when VALUES("xxx");; unsupported exception may should be handled. #750

Open
@jamhus-tao

Description

@jamhus-tao

BusTub crashed immediately when input VALUES("xxx");.
Such as follow:

bustub> VALUES ('123');
+--------------+
| __values#0.0 |
+--------------+
| 123          |
+--------------+
bustub> VALUES ("123");
AddressSanitizer:DEADLYSIGNAL
=================================================================
==15583==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x5634f19e280d bp 0x7ffc933d1290 sp 0x7ffc933d1270 T0)

which is securely handled on BustTub Web Shell like this:

bustub> VALUES ("123");
unsupported TableReferenceType

But SELECT "xxx"; can be handled.

bustub> SELECT "123";
Message :: unsupported TableReferenceType
unsupported TableReferenceType



The following information maybe useful to locate the problem:

VALUE("xxx"); was parsed as:

PGList(VALUES("xxx"))
     \
    PGList(("xxx"))
        \
       PGNode(("xxx"))
           \
     PGColumnRef("xxx")

And for SELECT "xxx";

PGSelectStmt(SELECT "xxx")
     \
    PGList("xxx")
        \
       PGResTarget("xxx")
           \
     PGColumnRef("xxx")

They step in the same funtion src/binder/bind_select.cpp:Binder::BindColumnRef but VALUE has no binder.scope_ (nullptr).

Thus, VALUE("xxx") takes runtime error on src/binder/bind_select.cpp:501.

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