Commit 299d44d
Avoid
* Avoid memcpy()-ing 0-length vectors
The C standard (before C23) says that giving invalid pointers, even with
length=0, to memcpy() is undefined behaviour. R returns an invalid
pointer for vectors of length 0, so avoid calls to memcpy() altogether
in such cases.
* Use early returns for 0-length cases
Co-authored-by: Michael Chirico <[email protected]>memcpy()-ing 0-length vectors (#6820)1 parent 6ea929f commit 299d44d
2 files changed
+13
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
538 | 543 | | |
539 | 544 | | |
540 | 545 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
225 | 233 | | |
226 | 234 | | |
227 | 235 | | |
| |||
250 | 258 | | |
251 | 259 | | |
252 | 260 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | 261 | | |
257 | 262 | | |
258 | 263 | | |
| |||
0 commit comments