U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ Core » Problem and fix in HexString
Problem and fix in HexString [message #28551] Mon, 06 September 2010 18:29 Go to next message
koldo is currently offline  koldo
Messages: 3465
Registered: August 2008
Senior Veteran
Hello Mirek

HexString(const byte *s, int count, int sep, int sepchr) function in file Util.cpp, line 545, does not support count == 0.

In that case, it tries to allocate:
StringBuffer b(2 * count + (count - 1) / sep)

, that is
StringBuffer b(-1)

, so it gives an exception.

Just beginning the function with a
if (count <= 0)
	return "";

would solve it.


Best regards
IƱaki
Re: Problem and fix in HexString [message #28557 is a reply to message #28551] Tue, 07 September 2010 05:28 Go to previous message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
Thanks, good catch.
Previous Topic: VectorMap<String,String> = Seg Fault
Next Topic: Problem and fix in LocalProcess
Goto Forum:
  


Current Time: Fri Dec 04 11:03:19 GMT+1 2026

Total time taken to generate the page: 0.03626 seconds