I think is an issue with GCC's buffer overflow analysis accuracy

Found an issue for it, on GCC v12.4, I am using v13.3

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114374

I have found quite a lot of issues relating to this on StackOverflow
and elsewhere but no reference to it on the GCC mailing list.

Hoping this might be fixed soon, it might reduce quite a lot of noise.

https://github.com/AaronNGray/pdfalto/actions/runs/13463238846/job/37623204502#step:9:450
```
/home/runner/work/pdfalto/pdfalto/src/AnnotsXrce.cc:444:59: warning:
‘%lg’ directive output may be truncated writing between 1 and 13 bytes
into a region of size 8 [-Wformat-truncation=]
450 444 | snprintf(temp, sizeof(temp), "%lg", x);
451 | ^~~
452/home/runner/work/pdfalto/pdfalto/src/AnnotsXrce.cc:444:58: note:
assuming directive output of 12 bytes
453 444 | snprintf(temp, sizeof(temp), "%lg", x);
454 | ^~~~~
```

```
snprintf(temp, sizeof(temp), "%lg", x);
```
https://github.com/AaronNGray/pdfalto/blob/buffer-overflows/src/AnnotsXrce.cc#L444

```
char *temp = (char *) malloc(16 * sizeof(char));
```
https://github.com/AaronNGray/pdfalto/blob/buffer-overflows/src/AnnotsXrce.cc#L419

-- 
Aaron Gray

Independent Open Source Software Engineer, Computer Language
Researcher, Information Theorist, and amateur computer scientist.

Reply via email to