Skip to content

Selecting a tinyint on SQL Server causes a panic #839

@charlieglnp

Description

@charlieglnp

Introduction

Trying to select a tinyint column on SQL server causes a panic

To Reproduce

Test table, data and component:

CREATE TABLE test_tinyint (
    name varchar(32),
    coltest tinyint
);

insert into test_tinyint values ('test1', 1)
insert into test_tinyint values ('test2', 10)
insert into test_tinyint values ('test3', 50)

SELECT 'list' as component;
select name as title, coltest as description FROM test_tinyint;

Actual behavior

Blank browser page and sqlpage crashes

thread 'actix-rt|system:0|arbiter:0' panicked at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\byteorder-1.5.0\src\lib.rs:2129:31:
range end index 2 out of range for slice of length 1
stack backtrace:
   0:     0x7ff7c55330c3 - <unknown>
   1:     0x7ff7c4d7d5aa - <unknown>
   2:     0x7ff7c55126c7 - <unknown>
   3:     0x7ff7c5534525 - <unknown>
   4:     0x7ff7c553435d - <unknown>
   5:     0x7ff7c5534983 - <unknown>
   6:     0x7ff7c5534609 - <unknown>
   7:     0x7ff7c553455f - <unknown>
   8:     0x7ff7c553454e - <unknown>
   9:     0x7ff7c57a7921 - <unknown>
  10:     0x7ff7c57a799e - <unknown>
  11:     0x7ff7c5267860 - <unknown>
  12:     0x7ff7c5265582 - <unknown>
  13:     0x7ff7c5022b79 - <unknown>
  14:     0x7ff7c515ec95 - <unknown>
  15:     0x7ff7c51f2460 - <unknown>
  16:     0x7ff7c50c0a18 - <unknown>
  17:     0x7ff7c554b9c4 - <unknown>
  18:     0x7ff7c4c521aa - <unknown>
  19:     0x7ff7c4c3d5fc - <unknown>
  20:     0x7ff7c4c3b5a2 - <unknown>
  21:     0x7ff7c553005d - <unknown>
  22:     0x7ffaaf077374 - BaseThreadInitThunk
  23:     0x7ffaaf21cc91 - RtlUserThreadStart

Expected behavior

A list component displayed with the titles 'test1', 'test2', 'test3' and descriptions of 1, 10, 20

Version information

  • OS: Windows 10
  • Database: SQL Server 2019
  • SQLPage Version: v0.32.1

Additional context

Casting coltest to an int mitigates the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions