tg icon indicating copy to clipboard operation
tg copied to clipboard

Compile error: ‘write’ reading 18 bytes from a region of size 17

Open roman4e opened this issue 2 years ago • 11 comments

While compiling with gcc -v =11.2.0 got next error: main.c:824:7: error: ‘write’ reading 18 bytes from a region of size 17 [-Werror=stringop-overread] 824 | if (write (1, "SIGNAL received\n", 18) < 0) {

String "SIGNAL received\n" has size 17.

roman4e avatar Oct 18 '22 20:10 roman4e

I did this today on Ubuntu 22.04 and got the same on GNU Make 4.3

jimthedj65 avatar Oct 19 '22 10:10 jimthedj65

Same bro. It also doen't work on Ubuntu 22.04 on my machine.

skadomsky avatar Jan 07 '23 14:01 skadomsky

Fedora 37, same

i-simakov avatar Feb 22 '23 17:02 i-simakov

I'm also suffering from this issue on Debian 12 (stable)

SevenChalices avatar Jun 19 '23 20:06 SevenChalices

same

AnatoliyZhurilo avatar Sep 21 '23 20:09 AnatoliyZhurilo

try this: with modified tg/Makefile and deleted -Werror nano Makefile ./configure make

Paulchen232 avatar Sep 22 '23 01:09 Paulchen232

Or change main.c:824 18 -> 17

make

Paulchen232 avatar Sep 22 '23 02:09 Paulchen232

Anyone managed to solve this?

dorsegal avatar Feb 09 '24 14:02 dorsegal

unfortunately, didn't help even after advices from @Paulchen232

uname -a
Linux ubuntu 5.15.0-87-generic #97-Ubuntu SMP Tue Oct 3 09:52:42 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

usmanovbf avatar Jul 17 '24 07:07 usmanovbf

and after changing this https://github.com/vysheng/tg/issues/1763#issuecomment-1730716616 I get

tgl/queries.c: In function \u2018_tgl_do_send_photo\u2019:
tgl/queries.c:2091:10: error: cast between incompatible function types from \u2018void (*)(struct tgl_state *, void *, int,  struct tgl_message *)\u2019 to \u2018void (*)(struct tgl_state *, void *, int)\u2019 [-Werror=cast-function-type]
 2091 |         ((void (*)(struct tgl_state *, void *, int))callback) (TLS, callback_extra, 0);
      |          ^
tgl/queries.c:2108:10: error: cast between incompatible function types from \u2018void (*)(struct tgl_state *, void *, int,  struct tgl_message *)\u2019 to \u2018void (*)(struct tgl_state *, void *, int)\u2019 [-Werror=cast-function-type]
 2108 |         ((void (*)(struct tgl_state *, void *, int))callback) (TLS, callback_extra, 0);
      |          ^
tgl/queries.c:2141:10: error: cast between incompatible function types from \u2018void (*)(struct tgl_state *, void *, int,  struct tgl_message *)\u2019 to \u2018void (*)(struct tgl_state *, void *, int)\u2019 [-Werror=cast-function-type]
 2141 |         ((void (*)(struct tgl_state *, void *, int))callback) (TLS, callback_extra, 0);
      |          ^
cc1: all warnings being treated as errors
make: *** [Makefile.tgl:20: objs/queries.o] Error 1

usmanovbf avatar Jul 17 '24 07:07 usmanovbf

BTW, the strange behavior is that I don't have libpython-dev but I had to install libpython2-dev

sudo apt-get install libreadline-dev libconfig-dev libssl-dev lua5.2 liblua5.2-dev libevent-dev libjansson-dev libpython-dev make 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package libpython-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  libpython2-dev

E: Package 'libpython-dev' has no installation candidate

usmanovbf avatar Jul 17 '24 07:07 usmanovbf