ora:kra: qstrcmp -> qstrncmp
ClosedPublic

Authored by aacid on Mar 31 2019, 3:40 PM.

Details

Summary

Makes oss-fuzz happier

Diff Detail

Repository
R287 KImageFormats
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
aacid created this revision.Mar 31 2019, 3:40 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptMar 31 2019, 3:40 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
aacid requested review of this revision.Mar 31 2019, 3:40 PM
pino added a subscriber: pino.Mar 31 2019, 4:02 PM
pino added inline comments.
src/imageformats/kra.cpp
22

this also counts the null terminator (as it is part of the static string)

61

this can be memcmp even (slightly faster than str*cmp)

src/imageformats/ora.cpp
21

ditto

60

ditto

aacid updated this revision to Diff 55138.Mar 31 2019, 4:51 PM

use strlen instead of sizeof to not include the trailing \0

apol added a subscriber: apol.Mar 31 2019, 6:08 PM

+1 otherwise

src/imageformats/kra.cpp
21

how about calling it s_mimetype?

aacid marked 4 inline comments as done.Mar 31 2019, 7:21 PM
aacid added inline comments.
src/imageformats/kra.cpp
21

nyeeee. It happens to be the mimetype, but here we're using it as magic to detect if the file is a file we care about or not, i'd prefer to keep it calling magic tbh

svuorela accepted this revision.Mar 31 2019, 7:29 PM
This revision is now accepted and ready to land.Mar 31 2019, 7:29 PM
This revision was automatically updated to reflect the committed changes.