From: Igor Munkin <imun@tarantool.org> To: Roman Khabibov <roman.habibov@tarantool.org> Cc: tarantool-patches@dev.tarantool.org, alexander.turenko@tarantool.org Subject: Re: [Tarantool-patches] [PATCH] serializer: check for recursive serialization Date: Mon, 23 Nov 2020 23:28:41 +0300 [thread overview] Message-ID: <20201123202841.GC14086@tarantool.org> (raw) In-Reply-To: <20201117164012.14652-1-roman.habibov@tarantool.org> Roma, Thanks for the patch! This version looks much better than the previous one, but I still have a couple of nits. Otherwise LGTM. On 17.11.20, Roman Khabibov wrote: > Print error if object after serialization is the same. I believe we need a doc request to update __serialize description, since its behaviour is restricted with the introduced constraint now. > > Closes #3228 > --- > > Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/serialize-check > Issue: https://github.com/tarantool/tarantool/issues/3228 > > @ChangeLog: > * Fix bug with bus error when __serialize function generates infinite recursion (gh-3228). > > src/lua/utils.c | 5 +++++ > ...-3228-serializer-look-for-recursion.result | 19 +++++++++++++++++++ > ...228-serializer-look-for-recursion.test.lua | 8 ++++++++ > 3 files changed, 32 insertions(+) > create mode 100644 test/app/gh-3228-serializer-look-for-recursion.result > create mode 100644 test/app/gh-3228-serializer-look-for-recursion.test.lua > <snipped> > diff --git a/test/app/gh-3228-serializer-look-for-recursion.result b/test/app/gh-3228-serializer-look-for-recursion.result > new file mode 100644 > index 000000000..cd86ab06a > --- /dev/null > +++ b/test/app/gh-3228-serializer-look-for-recursion.result > @@ -0,0 +1,19 @@ > +-- test-run result file version 2 > +test_run = require('test_run').new() > + | --- > + | ... > + > +-- > +-- gh-3228: Check the error message in the case of a __serialize > +-- function generating infinite recursion. > +-- > +setmetatable({}, {__serialize = function(a) return a end}) > + | --- > + | - error: 'console: an exception occurred when formatting the output: Bad __serialize > + | function. It can''t return the same value.' > + | ... > +setmetatable({}, {__serialize = function(a, b, c) return a, b, c end}) > + | --- > + | - error: 'console: an exception occurred when formatting the output: Bad __serialize > + | function. It can''t return the same value.' Hm, AFAICS the custom serializer accepts a single argument (i.e. "self") and a single return value is expected (considering the code you were around to). Hence, the latter check is the same as the first one and checks literally nothing. By the way, I guess it's worth to check that __eq metamethod is ignored when the object itself is compared with its "serialized" value. Just to be sure it won't be broken unintentionally in future. > + | ... <snipped> > -- > 2.24.3 (Apple Git-128) > -- Best regards, IM
next prev parent reply other threads:[~2020-11-23 20:28 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-17 16:40 Roman Khabibov 2020-11-23 20:28 ` Igor Munkin [this message] 2020-11-24 1:51 ` roman 2020-12-02 0:53 ` Roman Khabibov 2020-12-08 16:59 ` Sergey Ostanevich 2020-12-08 17:25 ` Igor Munkin 2020-12-11 3:22 ` Roman Khabibov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201123202841.GC14086@tarantool.org \ --to=imun@tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=roman.habibov@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH] serializer: check for recursive serialization' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox