jdk/src/share/native/com/sun/java/util/jar/pack/bands.h

Print this page
rev 5678 : 7186957: Improve Pack200 data validation
Reviewed-by: jrose, jjh, mschoene


  84   }
  85 
  86   void setIndex(cpindex* ix_);
  87   void setIndexByTag(byte tag);
  88 
  89   // Parse the band and its meta-coding header.
  90   void readData(int expectedLength = 0);
  91 
  92   // Reset the band for another pass (Cf. Java Band.resetForSecondPass.)
  93   void rewind() {
  94     cm.reset(&vs[0]);
  95   }
  96 
  97   byte* &curRP()    { return vs[0].rp; }
  98   byte*  minRP()    { return cm.vs0.rp; }
  99   byte*  maxRP()    { return rplimit; }
 100   size_t size()     { return maxRP() - minRP(); }
 101 
 102   int    getByte()  { assert(ix == null); return vs[0].getByte(); }
 103   int    getInt()   { assert(ix == null); return vs[0].getInt(); }
 104   entry* getRefN()  { assert(ix != null); return getRefCommon(ix, true); }
 105   entry* getRef()   { assert(ix != null); return getRefCommon(ix, false); }
 106   entry* getRefUsing(cpindex* ix2)
 107                     { assert(ix == null); return getRefCommon(ix2, true); }
 108   entry* getRefCommon(cpindex* ix, bool nullOK);
 109   jlong  getLong(band& lo_band, bool have_hi);
 110 
 111   static jlong makeLong(uint hi, uint lo) {
 112     return ((julong)hi << 32) + (((julong)lo << 32) >> 32);
 113   }
 114 
 115   int    getIntTotal();
 116   int    getIntCount(int tag);
 117 
 118   static band* makeBands(unpacker* u);
 119   static void initIndexes(unpacker* u);
 120 
 121 #ifndef PRODUCT
 122   void dump();
 123 #endif
 124 
 125   void abort(const char* msg = null); //{ u->abort(msg); }




  84   }
  85 
  86   void setIndex(cpindex* ix_);
  87   void setIndexByTag(byte tag);
  88 
  89   // Parse the band and its meta-coding header.
  90   void readData(int expectedLength = 0);
  91 
  92   // Reset the band for another pass (Cf. Java Band.resetForSecondPass.)
  93   void rewind() {
  94     cm.reset(&vs[0]);
  95   }
  96 
  97   byte* &curRP()    { return vs[0].rp; }
  98   byte*  minRP()    { return cm.vs0.rp; }
  99   byte*  maxRP()    { return rplimit; }
 100   size_t size()     { return maxRP() - minRP(); }
 101 
 102   int    getByte()  { assert(ix == null); return vs[0].getByte(); }
 103   int    getInt()   { assert(ix == null); return vs[0].getInt(); }
 104   entry* getRefN()  { return getRefCommon(ix, true); }
 105   entry* getRef()   { return getRefCommon(ix, false); }
 106   entry* getRefUsing(cpindex* ix2)
 107                     { assert(ix == null); return getRefCommon(ix2, true); }
 108   entry* getRefCommon(cpindex* ix, bool nullOK);
 109   jlong  getLong(band& lo_band, bool have_hi);
 110 
 111   static jlong makeLong(uint hi, uint lo) {
 112     return ((julong)hi << 32) + (((julong)lo << 32) >> 32);
 113   }
 114 
 115   int    getIntTotal();
 116   int    getIntCount(int tag);
 117 
 118   static band* makeBands(unpacker* u);
 119   static void initIndexes(unpacker* u);
 120 
 121 #ifndef PRODUCT
 122   void dump();
 123 #endif
 124 
 125   void abort(const char* msg = null); //{ u->abort(msg); }