Android tests
#97
I think I know, and I don't like the idea of itTongue
If I remember correctly, ARM is alignment-sensitive architecture - if you're reading an int from the memory, you'd better make damn sure you're reading from an address divisible by 4. Otherwise an alignment exception is thrown (SIGBUS).
What we have here is some arbitrary memory (AString's internal buffer), being written ints directly, without alignment. The compiler may have optimized something away (did you get warnings on strict aliasing?) and bam!, we have unaligned access.
I suppose, if you take out the htonl() function call, leaving only "Elements[i] = a_Value[i];", it still crashes? How about replacing a_Value[i] with a constant, say, 12? I suppose, still crashing.

Try rewriting it in this way:
Code:
void cFastNBTWriter::AddIntArray(const AString & a_Name, const int * a_Value, size_t a_NumElements)
{
    TagCommon(a_Name, TAG_IntArray);
    m_Result.reserve(m_Result.size() + 4 + a_NumElements * 4);
    Int32 len = htonl(a_NumElements);
    m_Result.append((const char *)&len, 4);
    int Element;
    m_Result.append(a_NumElements * 4, (char)0);
    for (size_t i = 0; i < a_NumElements; i++)
    {
        Element = htonl(a_Value[i]);
        m_Result.append((const char *)&Element, 4);
    }
}

If it works, make it a preprocessor #if #else #endif block for arm / intel
Reply
Thanks given by:


Messages In This Thread
Android tests - by xoft - 08-16-2012, 03:58 AM
RE: Android tests - by NiLSPACE - 08-16-2012, 04:37 AM
RE: Android tests - by xoft - 08-16-2012, 04:40 AM
RE: Android tests - by NiLSPACE - 08-16-2012, 04:47 AM
RE: Android tests - by xoft - 08-16-2012, 04:58 AM
RE: Android tests - by NiLSPACE - 08-16-2012, 05:05 AM
RE: Android tests - by FakeTruth - 08-16-2012, 05:18 AM
RE: Android tests - by FakeTruth - 08-16-2012, 06:45 AM
RE: Android tests - by FakeTruth - 08-16-2012, 07:00 AM
RE: Android tests - by NiLSPACE - 08-16-2012, 07:37 AM
RE: Android tests - by FakeTruth - 08-16-2012, 08:24 AM
RE: Android tests - by NiLSPACE - 08-16-2012, 08:43 AM
RE: Android tests - by NiLSPACE - 08-16-2012, 07:39 PM
RE: Android tests - by FakeTruth - 08-16-2012, 10:30 PM
RE: Android tests - by NiLSPACE - 08-16-2012, 10:36 PM
RE: Android tests - by FakeTruth - 08-17-2012, 05:32 AM
RE: Android tests - by NiLSPACE - 08-17-2012, 05:49 AM
RE: Android tests - by FakeTruth - 08-17-2012, 05:50 AM
RE: Android tests - by NiLSPACE - 08-17-2012, 05:54 AM
RE: Android tests - by FakeTruth - 08-17-2012, 05:55 AM
RE: Android tests - by xoft - 08-17-2012, 05:56 AM
RE: Android tests - by NiLSPACE - 08-17-2012, 05:56 AM
RE: Android tests - by FakeTruth - 08-17-2012, 05:56 AM
RE: Android tests - by NiLSPACE - 08-17-2012, 05:58 AM
RE: Android tests - by xoft - 08-17-2012, 06:00 AM
RE: Android tests - by NiLSPACE - 08-17-2012, 06:14 AM
RE: Android tests - by xoft - 08-17-2012, 06:18 AM
RE: Android tests - by FakeTruth - 08-17-2012, 06:29 AM
RE: Android tests - by NiLSPACE - 08-17-2012, 06:38 AM
RE: Android tests - by xoft - 08-17-2012, 05:54 PM
RE: Android tests - by xoft - 08-18-2012, 12:46 AM
RE: Android tests - by FakeTruth - 08-18-2012, 01:23 AM
RE: Android tests - by NiLSPACE - 08-18-2012, 01:28 AM
RE: Android tests - by FakeTruth - 08-18-2012, 01:49 AM
RE: Android tests - by NiLSPACE - 08-18-2012, 01:55 AM
RE: Android tests - by xoft - 08-18-2012, 01:57 AM
RE: Android tests - by NiLSPACE - 08-18-2012, 02:00 AM
RE: Android tests - by xoft - 08-18-2012, 02:03 AM
RE: Android tests - by NiLSPACE - 08-18-2012, 02:06 AM
RE: Android tests - by xoft - 08-18-2012, 04:28 AM
RE: Android tests - by NiLSPACE - 08-18-2012, 04:31 AM
RE: Android tests - by xoft - 08-18-2012, 04:44 AM
RE: Android tests - by FakeTruth - 08-18-2012, 07:15 AM
RE: Android tests - by NiLSPACE - 08-18-2012, 04:54 AM
RE: Android tests - by NiLSPACE - 08-18-2012, 07:23 AM
RE: Android tests - by FakeTruth - 08-18-2012, 07:33 AM
RE: Android tests - by NiLSPACE - 08-18-2012, 08:45 AM
RE: Android tests - by xoft - 08-18-2012, 05:58 PM
RE: Android tests - by NiLSPACE - 08-18-2012, 06:06 PM
RE: Android tests - by FakeTruth - 08-18-2012, 09:27 AM
RE: Android tests - by xoft - 08-18-2012, 07:51 PM
RE: Android tests - by FakeTruth - 08-18-2012, 09:04 PM
RE: Android tests - by bearbin - 08-18-2012, 08:51 PM
RE: Android tests - by FakeTruth - 08-19-2012, 07:08 AM
RE: Android tests - by ThuGie - 08-19-2012, 08:16 AM
RE: Android tests - by FakeTruth - 08-19-2012, 08:27 AM
RE: Android tests - by FakeTruth - 08-19-2012, 10:36 AM
RE: Android tests - by xoft - 08-19-2012, 06:08 PM
RE: Android tests - by NiLSPACE - 08-19-2012, 07:27 PM
RE: Android tests - by xoft - 08-19-2012, 08:55 PM
RE: Android tests - by NiLSPACE - 08-19-2012, 09:01 PM
RE: Android tests - by Lapayo - 08-19-2012, 09:05 PM
RE: Android tests - by xoft - 08-19-2012, 09:48 PM
RE: Android tests - by FakeTruth - 08-20-2012, 02:13 AM
RE: Android tests - by NiLSPACE - 08-20-2012, 02:18 AM
RE: Android tests - by FakeTruth - 08-20-2012, 02:19 AM
RE: Android tests - by FakeTruth - 08-20-2012, 02:54 AM
RE: Android tests - by NiLSPACE - 08-20-2012, 12:43 AM
RE: Android tests - by xoft - 08-20-2012, 06:59 PM
RE: Android tests - by FakeTruth - 08-20-2012, 08:38 PM
RE: Android tests - by xoft - 08-20-2012, 09:30 PM
RE: Android tests - by FakeTruth - 08-20-2012, 09:58 PM
RE: Android tests - by xoft - 08-21-2012, 12:07 AM
RE: Android tests - by Taugeshtu - 08-21-2012, 11:02 PM
RE: Android tests - by xoft - 08-22-2012, 12:05 AM
RE: Android tests - by FakeTruth - 08-22-2012, 12:26 AM
RE: Android tests - by Taugeshtu - 08-22-2012, 10:52 PM
RE: Android tests - by FakeTruth - 08-22-2012, 10:54 PM
RE: Android tests - by NiLSPACE - 08-22-2012, 11:15 PM
RE: Android tests - by Taugeshtu - 08-22-2012, 11:22 PM
RE: Android tests - by FakeTruth - 08-23-2012, 05:57 AM
RE: Android tests - by NiLSPACE - 09-22-2012, 09:47 PM
RE: Android tests - by FakeTruth - 09-23-2012, 12:05 AM
RE: Android tests - by FakeTruth - 09-26-2012, 10:33 PM
RE: Android tests - by FakeTruth - 09-27-2012, 01:19 AM
RE: Android tests - by NiLSPACE - 09-29-2012, 12:04 AM
RE: Android tests - by FakeTruth - 09-29-2012, 12:39 AM
RE: Android tests - by l0udPL - 09-29-2012, 04:58 AM
RE: Android tests - by NiLSPACE - 09-29-2012, 08:29 PM
RE: Android tests - by NiLSPACE - 09-30-2012, 04:11 AM
RE: Android tests - by FakeTruth - 09-30-2012, 04:25 AM
RE: Android tests - by NiLSPACE - 09-30-2012, 04:28 AM
RE: Android tests - by NiLSPACE - 10-01-2012, 07:08 PM
RE: Android tests - by ThuGie - 10-02-2012, 03:16 AM
RE: Android tests - by FakeTruth - 11-12-2012, 06:41 AM
RE: Android tests - by FakeTruth - 11-12-2012, 06:49 AM
RE: Android tests - by xoft - 11-12-2012, 07:18 AM
RE: Android tests - by FakeTruth - 11-12-2012, 07:25 AM
RE: Android tests - by FakeTruth - 11-12-2012, 07:28 AM
RE: Android tests - by FakeTruth - 11-12-2012, 07:49 AM
RE: Android tests - by FakeTruth - 11-12-2012, 08:36 AM
RE: Android tests - by xoft - 11-12-2012, 08:42 PM
RE: Android tests - by FakeTruth - 11-17-2012, 12:42 AM
RE: Android tests - by xoft - 11-17-2012, 01:43 AM
RE: Android tests - by FakeTruth - 11-17-2012, 02:20 AM
RE: Android tests - by xoft - 11-17-2012, 02:49 AM
RE: Android tests - by FakeTruth - 11-17-2012, 07:18 AM
RE: Android tests - by FakeTruth - 11-17-2012, 08:26 AM
RE: Android tests - by NiLSPACE - 11-17-2012, 08:51 AM
RE: Android tests - by FakeTruth - 11-17-2012, 09:19 AM
RE: Android tests - by NiLSPACE - 11-17-2012, 07:43 PM
RE: Android tests - by FakeTruth - 11-17-2012, 09:37 PM
RE: Android tests - by NiLSPACE - 11-17-2012, 09:50 PM
RE: Android tests - by FakeTruth - 11-17-2012, 11:07 PM
RE: Android tests - by NiLSPACE - 11-18-2012, 02:41 AM
RE: Android tests - by FakeTruth - 11-18-2012, 06:08 AM
RE: Android tests - by NiLSPACE - 11-23-2012, 06:01 AM
RE: Android tests - by xoft - 11-23-2012, 06:24 AM
RE: Android tests - by cardfire - 12-23-2012, 12:22 PM
RE: Android tests - by xoft - 12-23-2012, 01:58 PM
RE: Android tests - by cardfire - 12-26-2012, 06:11 PM
RE: Android tests - by xoft - 12-27-2012, 04:36 PM
RE: Android tests - by FakeTruth - 01-03-2013, 10:29 PM
RE: Android tests - by NiLSPACE - 01-03-2013, 11:46 PM
RE: Android tests - by FakeTruth - 01-04-2013, 12:07 AM
RE: Android tests - by LordKitsuna - 02-06-2013, 04:53 PM
RE: Android tests - by bearbin - 02-06-2013, 05:24 PM
RE: Android tests - by Mkvarner - 02-07-2013, 06:28 PM
RE: Android tests - by cardfire - 02-10-2013, 03:11 AM
RE: Android tests - by xoft - 02-10-2013, 06:40 AM
RE: Android tests - by Garmael - 02-20-2013, 08:20 PM
RE: Android tests - by NiLSPACE - 02-20-2013, 08:37 PM
RE: Android tests - by Garmael - 02-20-2013, 08:45 PM
RE: Android tests - by NiLSPACE - 02-20-2013, 08:50 PM
RE: Android tests - by Garmael - 02-20-2013, 08:55 PM
RE: Android tests - by Garmael - 02-20-2013, 10:28 PM
RE: Android tests - by NiLSPACE - 02-20-2013, 10:54 PM
RE: Android tests - by Garmael - 02-20-2013, 11:56 PM
RE: Android tests - by xoft - 02-21-2013, 12:00 AM
RE: Android tests - by Garmael - 02-21-2013, 01:36 AM
RE: Android tests - by cardfire - 02-27-2013, 04:48 AM
RE: Android tests - by FakeTruth - 02-21-2013, 05:28 AM
RE: Android tests - by NiLSPACE - 03-24-2013, 10:14 PM
RE: Android tests - by cardfire - 03-25-2013, 12:51 AM
RE: Android tests - by NiLSPACE - 04-10-2013, 01:21 AM
RE: Android tests - by FakeTruth - 04-10-2013, 04:55 AM
RE: Android tests - by NiLSPACE - 05-12-2013, 12:12 AM
RE: Android tests - by FakeTruth - 05-12-2013, 05:54 AM
RE: Android tests - by LordKitsuna - 05-13-2013, 12:13 AM
RE: Android tests - by NiLSPACE - 06-12-2013, 11:55 PM
RE: Android tests - by NiLSPACE - 06-26-2013, 01:43 AM
RE: Android tests - by DrkCodeman - 06-29-2013, 04:59 AM
RE: Android tests - by xoft - 06-29-2013, 05:04 AM
RE: Android tests - by DrkCodeman - 06-29-2013, 05:29 AM
RE: Android tests - by tonibm19 - 06-29-2013, 05:41 AM
RE: Android tests - by NiLSPACE - 06-29-2013, 05:43 AM
RE: Android tests - by DrkCodeman - 06-29-2013, 06:00 AM
RE: Android tests - by NiLSPACE - 08-29-2013, 02:35 AM
RE: Android tests - by tonibm19 - 09-30-2013, 04:42 AM
RE: Android tests - by NiLSPACE - 12-23-2013, 11:54 PM
RE: Android tests - by FakeTruth - 12-24-2013, 12:49 AM
RE: Android tests - by NiLSPACE - 12-24-2013, 12:53 AM
RE: Android tests - by NiLSPACE - 12-24-2013, 02:01 AM
RE: Android tests - by FakeTruth - 12-24-2013, 03:03 AM
RE: Android tests - by NiLSPACE - 12-24-2013, 03:23 AM
RE: Android tests - by FakeTruth - 12-24-2013, 03:33 AM
RE: Android tests - by NiLSPACE - 12-24-2013, 04:03 AM
RE: Android tests - by FakeTruth - 12-24-2013, 04:54 AM
RE: Android tests - by NiLSPACE - 12-24-2013, 04:59 AM
RE: Android tests - by FakeTruth - 12-24-2013, 06:36 AM
RE: Android tests - by NiLSPACE - 12-24-2013, 06:39 AM
RE: Android tests - by tigerw - 12-24-2013, 06:49 AM
RE: Android tests - by NiLSPACE - 12-24-2013, 06:54 AM
RE: Android tests - by FakeTruth - 12-24-2013, 06:55 AM
RE: Android tests - by NiLSPACE - 12-24-2013, 06:59 AM
RE: Android tests - by bearbin - 12-24-2013, 07:45 AM
RE: Android tests - by FakeTruth - 12-24-2013, 07:46 AM
RE: Android tests - by NiLSPACE - 12-24-2013, 07:47 AM
RE: Android tests - by NiLSPACE - 12-24-2013, 08:09 PM
RE: Android tests - by xoft - 12-24-2013, 08:26 PM
RE: Android tests - by NiLSPACE - 12-24-2013, 08:45 PM
RE: Android tests - by NiLSPACE - 12-24-2013, 10:46 PM
RE: Android tests - by tigerw - 12-25-2013, 03:32 AM
RE: Android tests - by bearbin - 12-25-2013, 08:08 AM
RE: Android tests - by tigerw - 12-25-2013, 09:37 AM
RE: Android tests - by FakeTruth - 12-25-2013, 10:07 AM
RE: Android tests - by NiLSPACE - 06-08-2014, 08:13 AM
RE: Android tests - by bearbin - 06-08-2014, 04:52 PM
RE: Android tests - by NiLSPACE - 06-08-2014, 07:30 PM
RE: Android tests - by xoft - 06-10-2014, 01:11 AM
RE: Android tests - by worktycho - 06-10-2014, 01:48 AM
RE: Android tests - by NiLSPACE - 10-30-2014, 06:05 AM
RE: Android tests - by FakeTruth - 10-30-2014, 08:10 AM
RE: Android tests - by NiLSPACE - 10-31-2014, 06:05 AM
RE: Android tests - by tonibm19 - 12-04-2014, 12:01 AM
RE: Android tests - by NiLSPACE - 12-29-2014, 12:55 AM
RE: Android tests - by tonibm19 - 12-29-2014, 01:07 AM
RE: Android tests - by NiLSPACE - 12-29-2014, 03:41 AM
RE: Android tests - by tonibm19 - 12-29-2014, 04:21 AM
RE: Android tests - by NiLSPACE - 12-29-2014, 05:17 AM
RE: Android tests - by LO1ZB - 12-29-2014, 05:26 AM
RE: Android tests - by NiLSPACE - 12-29-2014, 05:48 AM
RE: Android tests - by tigerw - 12-29-2014, 07:51 AM
RE: Android tests - by NiLSPACE - 12-29-2014, 07:59 AM
RE: Android tests - by LO1ZB - 12-29-2014, 09:28 AM
RE: Android tests - by NiLSPACE - 12-29-2014, 09:50 AM
RE: Android tests - by LO1ZB - 12-29-2014, 09:53 AM
RE: Android tests - by NiLSPACE - 12-29-2014, 10:20 AM
RE: Android tests - by LO1ZB - 12-30-2014, 08:17 AM
RE: Android tests - by NiLSPACE - 12-30-2014, 08:30 AM
RE: Android tests - by tigerw - 04-16-2015, 10:06 AM
RE: Android tests - by worktycho - 04-16-2015, 10:40 AM
RE: Android tests - by tigerw - 04-16-2015, 08:58 PM
RE: Android tests - by worktycho - 04-16-2015, 10:09 PM
RE: Android tests - by tigerw - 08-27-2015, 08:54 AM
RE: Android tests - by worktycho - 08-27-2015, 09:00 AM
RE: Android tests - by tigerw - 08-28-2015, 11:13 PM
RE: Android tests - by worktycho - 08-29-2015, 01:53 AM
RE: Android tests - by xoft - 08-30-2015, 09:23 AM
RE: Android tests - by worktycho - 08-30-2015, 09:38 AM
RE: Android tests - by tigerw - 08-31-2015, 08:12 AM
RE: Android tests - by worktycho - 08-31-2015, 08:50 AM
RE: Android tests - by NiLSPACE - 08-31-2015, 03:28 PM
RE: Android tests - by tonibm19 - 08-31-2015, 06:31 PM
RE: Android tests - by NiLSPACE - 08-31-2015, 07:28 PM
RE: Android tests - by tonibm19 - 08-31-2015, 09:51 PM
RE: Android tests - by NiLSPACE - 08-31-2015, 09:58 PM
RE: Android tests - by tigerw - 09-01-2015, 01:55 AM
RE: Android tests - by NiLSPACE - 09-01-2015, 02:38 AM
RE: Android tests - by tonibm19 - 09-01-2015, 03:35 AM
RE: Android tests - by NiLSPACE - 09-18-2015, 04:37 PM
RE: Android tests - by tonibm19 - 09-18-2015, 11:34 PM
RE: Android tests - by worktycho - 09-18-2015, 11:49 PM
RE: Android tests - by NiLSPACE - 09-18-2015, 11:55 PM
RE: Android tests - by worktycho - 09-19-2015, 12:06 AM
RE: Android tests - by NiLSPACE - 10-06-2015, 04:42 AM



Users browsing this thread: 60 Guest(s)