Skip to content
This repository was archived by the owner on Jul 25, 2020. It is now read-only.
This repository was archived by the owner on Jul 25, 2020. It is now read-only.

Cursor::get_text() is not safe #92

Closed
@dckc

Description

@dckc

sqlite3_column_text() can return NULL and get_text() doesn't handle it. For example, these tests will result in a SEGV (status=11):

    #[test]
    fn get_text_without_step() {
        let db = checked_open();
        let c = checked_prepare(&db, "select 1 + 1");
        assert_eq!(c.get_text(0).as_slice(), "");
    }

    #[test]
    fn get_text_on_bogus_col() {
        let db = checked_open();
        let c = checked_prepare(&db, "select 1 + 1");
        c.step();
        assert_eq!(c.get_text(1).as_slice(), "");
    }

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