71 Commits

Author SHA1 Message Date
pstef
790deebe42
Silence GCC 14 warning [-Warray-bounds=] (#17110)
* Silence GCC 14 warning [-Warray-bounds=]

GCC reports a couple of warnings like this example:
libretro-common/cdrom/cdrom.c:395:14: warning: array subscript 6 is outside array bounds of 'unsigned char[6]' [-Warray-bounds=]
  395 |       cmd[6] = cmd[3];
      |       ~~~~~~~^~~~~~~~
libretro-common/cdrom/cdrom.c: In function 'cdrom_unlock':
libretro-common/cdrom/cdrom.c:1268:18: note: at offset 6 into object 'cdb' of size 6
 1268 |    unsigned char cdb[] = {0x1E, 0, 0, 0, 0x2, 0};

The static analysis heuristic doesn't consider the fact that the writes to cmd[6] and later only happen under the condition that `if (cmd[0] == 0xBE || cmd[0] == 0xB9)` and that in all of those cases the array passed is wide enough. So this is a false positive.

Nevertheless, there seems to be an easy way to silence the warning without disabling it: just require all arrays passed to be at least 9 bytes long and explicitly set the size of those arrays that have been shorter to 9.

* Work around the requirement of C89

I used a C99 construct, but this is easy to work around
with a run-time check.

* Restore the check for non-null cmd

It was obsoleted in a previous version, but is needed back now.

---------

Co-authored-by: pstef <3462925+pstef@users.noreply.github.com>
2024-10-21 14:45:23 -07:00
libretroadmin
edecf0cb2d Replace more strlcat calls with strlcpy 2023-06-18 19:25:24 +02:00
libretroadmin
246cceeb27 Silence more signedness warnings 2023-06-14 19:51:31 +02:00
Grisly Glee
4202f8650d
Fix trivial signedness warnings (#15377)
* Fix trivial signedness warnings

* Followup on trivial signedness warnings
2023-06-14 04:43:11 +02:00
libretroadmin
c570e657c1 (CDROM) Fix memory leak caught with asan - buf passed to filestream_read_file
was not being freed after we were done with it (we are done with it after iterating
over the string list)
2022-07-15 19:00:59 +02:00
jdgleaver
6c8c8b73f2 libretro-common/cdrom: Add missing compatibility header 2020-10-05 10:28:45 +01:00
twinaphex
74fc0ba494 Buildfix 2020-08-26 15:06:34 +02:00
twinaphex
662e37f670 Replace more instances of string_split 2020-08-26 13:35:05 +02:00
twinaphex
601a73fa8b Use string_starts_with_size where possible - avoids the strlen 2020-06-25 12:51:04 +02:00
twinaphex
8fccac666e Use STRLEN_CONST where possible 2020-06-24 22:57:41 +02:00
twinaphex
d9bbe604e9 silence unused variable warnings 2020-05-24 19:13:22 +02:00
twinaphex
67f0df94f9 (CDROM) Reduce log spam 2020-05-24 19:11:55 +02:00
twinaphex
3b492142db Add CDROM_DEBUG ifdefs around this 2020-02-01 19:39:44 +01:00
twinaphex
cd9ca691ca (libretro-common) Update copyright 2020-01-31 15:43:42 +01:00
Twinaphex
29dc30fa48
Revert " add hashing support for PSX cheevos (bin/cue, chd, or real CD)" 2019-08-30 15:55:07 +02:00
Jamiras
bcd61d7f9b add hashing support for PSX cheevos (bin/cue, chd, or real CD) 2019-08-29 21:05:14 -06:00
twinaphex
d6df17a154 Revert "add hashing support for PSX cheevos (bin/cue, chd, or real CD)"
This reverts commit 11854333742fd7887cfa4f818d848963a82fab76.
2019-08-30 03:14:42 +02:00
Jamiras
1185433374 add hashing support for PSX cheevos (bin/cue, chd, or real CD) 2019-08-23 08:02:06 -06:00
Brad Parker
3432f3b852 cdrom: initialize all buffers used for drive paths, make sure to null-terminate filled paths in all cases 2019-08-12 20:42:40 -04:00
Brad Parker
39187f33b1 cdrom: print fix 2019-07-29 14:15:24 -04:00
Brad Parker
6cf3b0b769 cdrom: fix prints 2019-07-29 14:08:32 -04:00
Brad Parker
afc2888116 cdrom: add some debug prints if we cannot find any devices 2019-07-25 14:02:28 -04:00
Brad Parker
d8b99470b3 cdrom: add debug print if no sg devices were found\n 2019-07-25 09:53:53 -04:00
Brad Parker
a5f5d2b328 Update Japanese translation, cdrom cleanups 2019-07-23 22:36:29 -04:00
LazyBumHorse
2de6e9b43a silence compiler warnings 2019-07-22 19:27:31 +02:00
Brad Parker
41b3adc8a4 cdrom: always request one sector at a time 2019-07-21 12:06:10 -04:00
Brad Parker
84ac0dbc5b cdrom: skip retries for MODE SENSE command 2019-07-16 00:46:02 -07:00
Brad Parker
cc3b44f7ba cdrom: fix warnings, use dot for frame notation in disc info 2019-07-15 17:16:30 -04:00
Brad Parker
e843354b14 cdrom: use sys/ioctl header instead of stropts 2019-07-15 10:38:54 -04:00
Brad Parker
534b9125a9 cdrom: C89 fix, timeout calculation fix 2019-07-15 00:55:06 -04:00
Brad Parker
cf12a10ba0 cdrom: add CDROM tag to log prints 2019-07-10 20:56:23 -04:00
Brad Parker
980de11974 cdrom: check if disc is inserted before trying to load or dump 2019-07-10 11:17:28 -04:00
Brad Parker
b564441097 fix some warnings 2019-07-09 22:34:28 -04:00
Brad Parker
60e7e5be8d fix some warnings 2019-07-09 22:32:11 -04:00
Brad Parker
ae87f87ee3 C89 buildfix 2019-07-09 16:46:53 -04:00
twinaphex
124283a934 (MSVC 2010) Add HAVE_CDROM
(CDROM) Ensure code compiles with MSVC
2019-07-09 09:23:47 +02:00
Brad Parker
f94a924be9 cdrom: skip retries for ATIP read if command fails 2019-07-08 23:46:42 -04:00
Brad Parker
cd98fa2745 cdrom: fix drive model string corruption 2019-07-08 16:06:35 -04:00
Brad Parker
15d97dbaf3 cdrom: add disc dump option 2019-07-08 16:06:35 -04:00
Brad Parker
2ef16de941 cdrom: add atip check function, show relative and absolute MSF for read command 2019-07-08 16:06:35 -04:00
Brad Parker
9e4ce6c7e3 cdrom: fix group1 timeout error 2019-07-06 21:54:10 -04:00
Brad Parker
59d8b918a1 cdrom: store group timeouts 2019-07-06 20:16:47 -04:00
Brad Parker
44245cc942 cdrom: windows cue fix 2019-07-06 17:23:10 -04:00
Brad Parker
46ed5c3fcb vfs: fix circular dependency issues by moving main structs to separate header 2019-07-05 23:45:48 -04:00
Brad Parker
d116784249 cdrom: go back to MSF read command, still having issues with LBA calculation 2019-07-05 11:09:11 -04:00
Brad Parker
e8d488ba67 cdrom: fix conflict with libchdr function names 2019-07-04 23:05:28 -04:00
Brad Parker
d0695fc428 cdrom: add LBA offset 2019-07-04 22:42:42 -04:00
Brad Parker
38d49136ce cdrom: add function for reading via LBA numbers 2019-07-04 18:20:05 -04:00
Brad Parker
9d163493da cdrom: print sense data on each failure 2019-07-04 17:47:39 -04:00
Brad Parker
7db030f98e cdrom: add command to retrieve/print sense data 2019-07-04 16:15:21 -04:00