]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
UBSan: Contain pos - fp->bufpos in parentheses 670/head
authorRose <83477269+AtariDreams@users.noreply.github.com>
Sun, 23 Apr 2023 16:25:39 +0000 (12:25 -0400)
committerRose <83477269+AtariDreams@users.noreply.github.com>
Tue, 25 Apr 2023 16:03:22 +0000 (12:03 -0400)
Yes I know this shouldn't change the behavior in theory, but clang insists it does in practice, so to quiet the UBSan, I put parentheses around pos - fp->bufpos.

cups/file.c

index 2fd07808046ac15df5a85a7a28dc3fbf643ce0b7..ead31aab5fe8663c2324e606bd49697e1eb009c1 100644 (file)
@@ -1825,7 +1825,7 @@ cupsFileSeek(cups_file_t *fp,             /* I - CUPS file */
       */
 
       fp->pos = pos;
-      fp->ptr = fp->buf + pos - fp->bufpos;
+      fp->ptr = fp->buf + (pos - fp->bufpos);
       fp->eof = 0;
 
       return (pos);