Skip to content

Commit

Permalink
fixed pointer handling in StrAgg unpacking
Browse files Browse the repository at this point in the history
  • Loading branch information
lee218llnl committed Sep 7, 2016
1 parent 80937b9 commit e3acc5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dysect/DysectAPI/Aggregates/StrAgg.C
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ std::map<string, int>& StrAgg::getCountMap() {
bool StrAgg::deserialize(void* payload) {
// Deserialize
int num = *(int*)payload; // First bytes are for number of functions in payload
int ss = sizeof(int);

//printf(">>> num %d\n", num);

// Compute offsets
int *counts = (int*)((int*)payload + sizeof(int));
int *counts = (int*)((int*)payload + 1);
char* strs = (char*)((char*)payload + sizeof(int) + (num * sizeof(int)));

char *ptr = strs;
Expand Down Expand Up @@ -264,7 +265,6 @@ bool StrAgg::getStr(string& str) {
string name = countMapIter->first;

sprintf((char*)&buf, "%d:%s ", count, name.c_str());

str.append(buf);
}

Expand Down
1 change: 1 addition & 0 deletions src/dysect/libDysectAPI/include/DysectAPI/Err.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "LibDysectAPI.h"

#define DYSECTVERBOSE(...) Err::verbose(__LINE__, __FILE__, __VA_ARGS__)
#define DYSECTLOG(...) Err::log(__LINE__, __FILE__, __VA_ARGS__)
Expand Down

0 comments on commit e3acc5d

Please sign in to comment.