HaikuArchives / PhotoGrabber

PhotoGrabber is an application that downloads/deletes pictures from USB digital cameras
2 stars 10 forks source link

bugs found by llvm static analyzer #20

Closed Vidrep closed 5 years ago

Vidrep commented 6 years ago

File: ptp.c Warning: line 2012, column 10 Result of 'calloc' is converted to a pointer of type 'unsigned char', which is incompatible with sizeof operand type; 'uint32_t'data = calloc(sizeof(uint32_t),3);

File: ./ptp-pack.c Warning: line 252, column 10 Result of 'malloc' is converted to a pointer of type 'unsigned char', which is incompatible with sizeof operand type 'uint32_t' : data = malloc ((arraylen+1)sizeof(uint32_t));

korli commented 6 years ago

The code uses char indexes to use the data arrays, so this isn't a problem per se. It could be more readable by using uint32 pointers.

Vidrep commented 6 years ago

There were 13 errors detected in total, but I only did a copy/paste of 2. Can I zip up the html report and send it to you? It may be worth a look.

korli commented 6 years ago

You can attach to this ticket.

Vidrep commented 6 years ago

Here it is: scan-build-2018-10-08-100614-3418-1.zip

Korli, I have also attached similar reports for FtpPositive, and BePDF, if you don't mind having a look. Thanks!

owenca commented 5 years ago

Here is the summary of the above report. Clang Static Analyzer found 18 potential bugs. BugReport.pdf