Skip to content

Crash by IF and CHAR #7515

Closed
dolthub/go-mysql-server
#2334

Description

@suyZhong

The following test case crashed go-mysql-server.

CREATE TABLE t0(c0 INTEGER); 

INSERT INTO t0(c0) VALUES ('');
SELECT * FROM t0 WHERE t0.c0 = IF(t0.c0, 1, CHAR(t0.c0));

Besides, kindly inform me if there's any progress of issue #7372, since we repeatedly met issues related to string (might be duplicated), which partially blocked our testing.

Here's the error trace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x12ab6e8]

goroutine 578 [running]:
github.com/dolthub/go-mysql-server/sql/types.IsBlobType(...)
	/home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20240216195105-d69d7a2b7183/sql/types/typecheck.go:25
github.com/dolthub/go-mysql-server/sql/expression.convertHexBlobToDecimalForNumericContext({0x23e3dc0?, 0xc001a26a98?}, {0x0?, 0x0?})
	/home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20240216195105-d69d7a2b7183/sql/expression/convert.go:449 +0x68
github.com/dolthub/go-mysql-server/sql/expression.convertValue({0x23e3dc0?, 0xc001a26a98}, {0x28f9788?, 0x3296e60?}, {0x0?, 0x0?}, 0x41010c?, 0x3296e60?)
	/home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20240216195105-d69d7a2b7183/sql/expression/convert.go:348 +0x478
github.com/dolthub/go-mysql-server/sql/expression.convertLeftAndRight({0x240eea0?, 0x4666e80?}, {0x23e3dc0, 0xc001a26a98}, {0x28f9788, 0x6})
	/home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20240216195105-d69d7a2b7183/sql/expression/comparison.go:257 +0x85
github.com/dolthub/go-mysql-server/sql/expression.(*comparison).castLeftAndRight(0xc0019f7500, {0x240eea0, 0x4666e80}, {0x23e3dc0, 0xc001a26a98})
	/home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20240216195105-d69d7a2b7183/sql/expression/comparison.go:235 +0xcce
github.com/dolthub/go-mysql-server/sql/expression.(*comparison).Compare(0xc0019f7500, 0x0?, {0xc001a5ae70?, 0xa487be?, 0xc000cf8540?})
	/home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20240216195105-d69d7a2b7183/sql/expression/comparison.go:138 +0x30f
github.com/dolthub/go-mysql-server/sql/expression.(*Equals).Eval(0x1?, 0x0?, {0xc001a5ae70?, 0xc001a5ae70?, 0x0?})
	/home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20240216195105-d69d7a2b7183/sql/expression/comparison.go:296 +0x1a
github.com/dolthub/go-mysql-server/sql.EvaluateCondition(0xc000cf8480?, {0x321b7f0?, 0xc0019f7500?}, {0xc001a5ae70?, 0xc00199d5f8?, 0x1bfde20?})
	/home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20240216195105-d69d7a2b7183/sql/core.go:305 +0x3b
github.com/dolthub/go-mysql-server/sql/plan.(*FilterIter).Next(0xc0019f7660, 0xc000e10f00?)
	/home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20240216195105-d69d7a2b7183/sql/plan/filter.go:130 +0x7d
github.com/dolthub/go-mysql-server/sql/rowexec.transactionCommittingIter.Next(...)
	/home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20240216195105-d69d7a2b7183/sql/rowexec/transaction_iters.go:78
github.com/dolthub/go-mysql-server/sql/plan.(*trackedRowIter).Next(0xc000cf84c0, 0x1d1b4c0?)
	/home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20240216195105-d69d7a2b7183/sql/plan/process.go:357 +0x24
github.com/dolthub/go-mysql-server/server.(*Handler).doQuery.func2()
	/home/suyang/go/pkg/mod/github.com/dolthub/go-mysql-server@v0.17.1-0.20240216195105-d69d7a2b7183/server/handler.go:388 +0x125
golang.org/x/sync/errgroup.(*Group).Go.func1()
	/home/suyang/go/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 297
	/home/suyang/go/pkg/mod/golang.org/x/sync@v0.3.0/errgroup/errgroup.go:72 +0x96

I originally found this by building dolt from source version e709939

Activity

  1. added
    bugSomething isn't working
    good reproEasily reproducible bugs
    correctnessWe don't return the same result as MySQL
    on Feb 20, 2024
  2. fulghum commented on Feb 20, 2024

    @fulghum
    Contributor

    Hi @suyZhong, thank you for reporting this one and for all the testing you're doing with Dolt! 🙏 We'll dig into what's going on here and see if we can get you an update on #7372, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcorrectnessWe don't return the same result as MySQLcustomer issuegood reproEasily reproducible bugspanic

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions