Marcel, If you need help, I can look at this as well. The only issue with a fix will be the need to either invoke the String#getBytes(...) method twice or refactor the codec a bit. I don't know of a way to easily determine the number of bytes in a string without just converting to bytes in your desired encoding (UTF-8).
If interested, I'm also doing some work that I may add to zproto at some point for a codec that supports jzmq-api. The Message class is handling a lot of that now (not merged to main repo yet) so the codec gets a lot cleaner. https://github.com/sjohnr/jyre/blob/master/model/zmq_socket.gsl On Thu, Mar 9, 2017 at 8:40 AM Kevin Sapper <[email protected]> wrote: > Hi Marcel, > > this seems to be a bug. Can you send a PR to fix this issue. > > Thanks! > > //Kevin > > > On Do, Mär 9, 2017 at 2:56 , Marcel Möhring <[email protected]> > wrote: > > Hi, > > I’m experiencing a buffer overflow when using utf-8 with an zproto/gsl > generated message class. > > The framesize for strings seems to be calculated based on the number of > characters in a string. > Later the bytes of the string are put into a buffer and when the string > contains multi byte characters, the buffer overflows. > > Has anyone else experienced this behavior? > Or is this behavior intended, i.e. am I using it wrong? > > Cheers, > Marcel > > > -- > [email protected] > http://www.catapullt.de/ > > Büro: +49 202 430427-20 > Mobil: +49 173 7265151 > Fax: +49 202 430427-09 > > catapullt GmbH & Co. KG > In der Gelpe 79 > 42349 Wuppertal > > Geschäftsführer: Jürgen Weinrich > Amtsgericht: Wuppertal, HRA: 22523 > > _______________________________________________ > zeromq-dev mailing list > [email protected] > https://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________ zeromq-dev mailing list [email protected] https://lists.zeromq.org/mailman/listinfo/zeromq-dev
