ICU resource bundling on Linux: error faced while using Key more than 15 chars

Hi,

I am trying to use ICU resource bundle on Unix and created a resource bundle "root.res" from the following file.

root {
abcdefghijklmnop { "16 character key" }
abcdefghijklmno { "15 character key" }
abcdefghijklmn { "14 character key" }
abcdefghijklm12 { "13 C 2 Int" }
abcdefghijklm123 { "13 Char 3 Int" }
abcdefghij123456 { "10 char 6 int" }
ab1234567891012 { "1234567891012" }
abcdefghijklmnopqrstuvwxyz { "Char 26" }
}

When I use C++ program to fetch these data from the resource file, it throws the below error if key is more than 15 characters
(for example abcdefghijklmnop or abcdefghij123456).

[root@localhost ICU_POC]# ./StringExtern root

Enter the key : abcdefghij123456

Thing using cout = 10 char 6 int ----> output displayed before error.
*** glibc detected *** corrupted double-linked list: 0x087c51b8 ***
Aborted

Please note it was able to display the value but then threw the error.

If key is less than equal to 15 characters (for example abcdefghijklmno ) , values are fetched properly without errors.

[root@localhost ICU_POC]# ./StringExtern root

Enter the key : abcdefghijklmno

Thing using cout = 15 character key

This problem is seen only on Linux and not on windows. We are able to use keys (more than 16 characters) on Windows without any error.

Does anybody have an idea about this problem? Is this the limitation for Linux or something is wrong in execution?

C++ program:

#include <iostream>
#include "unicode/msgfmt.h"
#include "unicode/resbund.h"
#include "unicode/unistr.h"
#include "unicode/ulocdata.h"
#include "unicode/ustream.h"
#include <wchar.h>

int main(int argc, char* argv[])
{
   UErrorCode status = U_ZERO_ERROR;

   if ( argc !=2 )
   {
      cout << "Please run the executable in the following format:" << endl;
      cout << "StringExtern <locale code>" << endl;
      cout << "For reference of locale code see http://www.loc.gov/standards/iso639-2/" << endl;
      return 0;
   }

   //Setting the default locale passed by the user
   Locale::setDefault(argv[1],status);

   //Initializing  the constructor of the ResourceBundle class which takes two parameters.  //path of the .dat file, status)

   ResourceBundle resourceBundle("/root/Desktop/ICU_POC/myapp",status);
   
   //Check for the error in reading the .dat file(resource bundle)
   if(U_FAILURE(status)) 
   {
      printf("Can't open resource bundle. Error is %s\n", u_errorName(status));
      return 0;
   }

   //Extracting the text corresponding to the text passed to the getStringEx function.

   char *pj=new char();
   cout<<"\nEnter the key : ";
   cin>>pj;

   UnicodeString thing = resourceBundle.getStringEx(pj, status);

   // Check for the error in extractring the text (may not be a valid text)

   if(U_FAILURE(status))
   {
      printf("Can't find String. Error is %s\n", u_errorName(status));
      return 0;
   }

  cout<<"\nThing using cout = "<<thing<<endl;
   return 0;
}

Any input or help is appreciated in this regard.

Thanks,
Prashant Jindal