Repository navigation
Commit e83d321
committed
[Fix]
`isBuffer` duck-types buffers via `obj.constructor.isBuffer(obj)`
(since 3768a75 / v2.2.5, so that it works without referencing the `Buffer` global and recognizes polyfill and foreign-realm buffers),
but only checked that the property was truthy before calling it.
An object with an own `constructor` key whose `isBuffer` member is a non-function,
as produced by `qs.parse` under `plainObjects` or `allowPrototypes`,
or by `JSON.parse`,
made `stringify` throw `TypeError: obj.constructor.isBuffer is not a function`.
Require it to be callable before invoking it.
Real `Buffer`, `safer-buffer`,
and browserify `buffer` polyfill instances serialize exactly as before.utils: isBuffer: do not invoke a non-callable constructor.isBuffer
1 parent 7e87a07 commit e83d321
3 files changed
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | | - | |
| 332 | + | |
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
932 | 932 | | |
933 | 933 | | |
934 | 934 | | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
935 | 962 | | |
936 | 963 | | |
937 | 964 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
607 | 619 | | |
608 | 620 | | |
609 | 621 | | |
| |||
0 commit comments