Ben Wagner pushed to branch master at FreeType / FreeType
Commits:
-
a9793fea
by Ben Wagner at 2023-08-17T13:25:31-04:00
1 changed file:
Changes:
... | ... | @@ -141,7 +141,9 @@ |
141 | 141 | if ( read_bytes > count )
|
142 | 142 | read_bytes = count;
|
143 | 143 | |
144 | - FT_MEM_COPY( buffer, stream->base + pos, read_bytes );
|
|
144 | + /* Allow "reading" zero bytes without UB even if buffer is NULL */
|
|
145 | + if ( count )
|
|
146 | + FT_MEM_COPY( buffer, stream->base + pos, read_bytes );
|
|
145 | 147 | }
|
146 | 148 | |
147 | 149 | stream->pos = pos + read_bytes;
|
... | ... | @@ -178,7 +180,9 @@ |
178 | 180 | if ( read_bytes > count )
|
179 | 181 | read_bytes = count;
|
180 | 182 | |
181 | - FT_MEM_COPY( buffer, stream->base + stream->pos, read_bytes );
|
|
183 | + /* Allow "reading" zero bytes without UB even if buffer is NULL */
|
|
184 | + if ( count )
|
|
185 | + FT_MEM_COPY( buffer, stream->base + stream->pos, read_bytes );
|
|
182 | 186 | }
|
183 | 187 | |
184 | 188 | stream->pos += read_bytes;
|