Skip to content

Commit 4473cc1

Browse files
committed
[fix] Msgpack: avoid StackOverflow when packing unsupported type
The fallback payload included a java.lang.Class value, which itself isn't supported - so caused an infinite recursion.
1 parent 050affa commit 4473cc1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/taoensso/msgpack/impl.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@
133133
(pack-bytes [x ^DataOutput out]
134134
(pack-bytes
135135
{:msgpack/unpackable
136-
{:type (type x)
136+
{:type (str (type x))
137137
:preview
138138
(try
139-
(let [out (pr-str x)] (subs out 0 (min 16 (count out))))
139+
(let [out (pr-str x)] (subs out 0 (min 32 (count out))))
140140
(catch Throwable _ :unprintable))}}
141141
out)))
142142

src/taoensso/msgpack/impl.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@
277277
{:type (enc/type-name x)
278278
:preview
279279
(try
280-
(let [s (pr-str x)] (subs s 0 (min 16 (count s))))
280+
(let [s (pr-str x)] (subs s 0 (min 32 (count s))))
281281
(catch :default _ :unprintable))}}
282282
out))))
283283

0 commit comments

Comments
 (0)