Skip to content

app built without gcc will crash #443

Closed
@kpvt001

Description

@kpvt001

source code:

func main() {

	db,dberr:=sql.Open("sqlite3","./test.db")
	if dberr!=nil {
		fmt.Println(dberr.Error())
	}

	stmt,err2:=db.Prepare("INSERT INTO shipping_line(vessel_prefix, captin_name) values(?,?)")
	if err2!=nil{
		fmt.Println(err2.Error())
	}
        stmt.Exec("prefix", "captin")
}

output:

F:\gopath\src\project>project.exe
Exception 0xc0000005 0x8 0xd872f8 0xd872f8
PC=0xd872f8
signal arrived during external code execution

github.com/mattn/go-sqlite3._Cfunc__sqlite3_step(0x3f5a1b8, 0xc0421417f8, 0xc042141800, 0x0)
        github.com/mattn/go-sqlite3/_obj/_cgo_gotypes.go:241 +0x54
github.com/mattn/go-sqlite3.(*SQLiteStmt).exec.func4(0x3f5a1b8, 0xc0421417f8, 0xc042141800, 0xc04203a2a0)
        F:/gopath/src/github.com/mattn/go-sqlite3/sqlite3.go:966 +0x7b
github.com/mattn/go-sqlite3.(*SQLiteStmt).exec(0xc04215d620, 0x1488098, 0xc04203a2a0, 0xc042073400, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0)
        F:/gopath/src/github.com/mattn/go-sqlite3/sqlite3.go:966 +0x1a2
github.com/mattn/go-sqlite3.(*SQLiteStmt).ExecContext(0xc04215d620, 0xd8f120, 0xc04203a2a0, 0xc0420733b0, 0x2, 0x2, 0xc000000008, 0xc042056040, 0xc042083c98, 0x996b8c)
        F:/gopath/src/github.com/mattn/go-sqlite3/sqlite3_go18.go:68 +0x239
database/sql.ctxDriverStmtExec(0xd8f120, 0xc04203a2a0, 0xd8f360, 0xc04215d620, 0xc0420733b0, 0x2, 0x2, 0x0, 0x0, 0xc0421a09a0, ...)
        C:/Go/src/database/sql/ctxutil.go:66 +0x24b
database/sql.resultFromStatement(0xd8f120, 0xc04203a2a0, 0xc042151640, 0xc042083f58, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0)
        C:/Go/src/database/sql/sql.go:1841 +0x19a
database/sql.(*Stmt).ExecContext(0xc042142800, 0xd8f120, 0xc04203a2a0, 0xc042083f58, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0)
        C:/Go/src/database/sql/sql.go:1802 +0x259
database/sql.(*Stmt).Exec(0xc042142800, 0xc042083f58, 0x2, 0x2, 0x0, 0x0, 0x0, 0xc042083ed0)
        C:/Go/src/database/sql/sql.go:1814 +0x6c
main.main()
        F:/gopath/src/project/main.go:26 +0x1c0

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:2197 +0x1

goroutine 36 [chan receive]:
database/sql.(*DB).connectionOpener(0xc042137c20)
        C:/Go/src/database/sql/sql.go:837 +0x51
created by database/sql.Open
        C:/Go/src/database/sql/sql.go:582 +0x219

goroutine 37 [select]:
github.com/mattn/go-sqlite3.(*SQLiteStmt).exec.func3(0x1488098, 0xc04203a2a0, 0xc042039140, 0x1ea6648)
        F:/gopath/src/github.com/mattn/go-sqlite3/sqlite3.go:958 +0x11c
created by github.com/mattn/go-sqlite3.(*SQLiteStmt).exec
        F:/gopath/src/github.com/mattn/go-sqlite3/sqlite3.go:963 +0x13f
rax     0x0
rbx     0x3
rcx     0x1c8
rdi     0x1
rsi     0x1ea7650
rbp     0x0
rsp     0x147f948
r8      0x1
r9      0x0
r10     0x0
r11     0x246
r12     0x1ea6648
r13     0x1
r14     0x40
r15     0x0
rip     0xd872f8
rflags  0x10202
cs      0x33
fs      0x53
gs      0x2b

build cmd go build -ldflags="-linkmode=internal -extld=none"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions