Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] kws_raw_read block param value less than 10 will cause func alway return -1 #213

Open
chucongqing opened this issue Jul 10, 2024 · 1 comment

Comments

@chucongqing
Copy link
Contributor

libks/src/kws.c

Line 405 in dcddb83

KS_DECLARE(ks_ssize_t) kws_raw_read(kws_t *kws, void *data, ks_size_t bytes, int block)

kws_raw_read block param value less than 10 will cause func alway return -1

because

     int block_n = block / 10;  //block_n will be 0
      ...
     kws->x++;  //x will be at least 1
      ...
     if (kws->x >= 10000 || (block && kws->x >= block_n)) {   //so this will alway true and return -1
@seven1240
Copy link
Contributor

do you have a suggested fix? or just pass in a value of block > 10 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants