#fixed code
                                SegmentView getActiveSegmentView() { return segmentlist.get(segmentlist.size()-1); }
#vulnerable code 
                             EntryLocation getLocationForOffset(long offset)
	{
		EntryLocation ret = new EntryLocation();
	    SegmentView sv = this.getSegmentForOffset(offset);
		long reloff = offset - sv.startoff;
		
		//select the group using a simple modulo mapping function
		int gnum = (int)(reloff%sv.numgroups);	
		ret.group = sv.groups[gnum];
		ret.relativeOff = reloff/sv.numgroups + ret.group.localstartoff;

        log.info("location({}): seg.startOff={} gnum={} group-startOff={} relativeOff={} ",
                offset,
                sv.startoff,
                gnum,
                ret.group.localstartoff, ret.relativeOff);

		return ret;
	} 
                            #location 5 
                            #vulnerability type NULL_DEREFERENCE