Skip to content

Commit 3fe77bf

Browse files
committed
[RELEASE] iText 9.0.0
2 parents fc287bc + a157a78 commit 3fe77bf

File tree

2,197 files changed

+52166
-45302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,197 files changed

+52166
-45302
lines changed

README.md

+41-39
Large diffs are not rendered by default.

SECURITY.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# iText Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
We are committed to maintaining the security of our software. If you discover a security vulnerability, we encourage you to report it to us as soon as possible.
6+
7+
To report a vulnerability, please visit our [Vulnerability Reporting Page](https://itextpdf.com/report-vulnerability), or email [vulnerability@apryse.com](vulnerability@apryse.com). If you do not receive a response in 2 business days, please follow up as we may not have received your message.
8+
9+
We follow the procedure of Coordinated Vulnerability Disclosure (CVD) and, to protect the ecosystem, we request that those reporting do the same. Please visit the above page for more information, and follow the steps below to ensure that your report is handled promptly and appropriately:
10+
11+
1. **Do not disclose the vulnerability publicly** until we have had a chance to address it.
12+
2. **Provide a detailed description** of the vulnerability, including steps to reproduce it, if possible.
13+
3. **Include any relevant information** such as the version of iText Core you are using, your operating system, and any other pertinent details.
14+
15+
## Security Updates and Patches
16+
17+
When a vulnerability is reported, we will:
18+
19+
1. **Investigate and verify** the vulnerability.
20+
2. **Develop and test** a fix for the vulnerability.
21+
3. **Release a patch** as soon as possible.
22+
23+
## Known Vulnerabilities
24+
25+
The iText Knowledge Base has a page for known [Common Vulnerabilities and Exposures](https://kb.itextpdf.com/itext/cves) (CVEs), please check it to ensure your vulnerability has not already been disclosed or addressed.
26+
27+
## Supported product lines
28+
29+
See [Compatibility Matrix](https://kb.itextpdf.com/itext/compatibility-matrix)
30+
31+
## Security Best Practices
32+
33+
To help ensure the security of your applications using iText Core, we recommend the following best practices:
34+
35+
1. **Keep iText Core up to date** by regularly checking for and applying updates.
36+
2. **Review and follow** our security guidelines for secure usage.
37+
3. **Monitor your applications** for any unusual activity and investigate any anomalies promptly.
38+
39+
Thank you for helping us keep iText secure!

barcodes/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.itextpdf</groupId>
77
<artifactId>root</artifactId>
8-
<version>8.0.5</version>
8+
<version>9.0.0</version>
99
</parent>
1010

1111
<artifactId>barcodes</artifactId>

barcodes/src/main/java/com/itextpdf/barcodes/BarcodeDataMatrix.java

+31-28
Original file line numberDiff line numberDiff line change
@@ -373,28 +373,30 @@ public int setCode(byte[] text, int textOffset, int textSize) {
373373
switchMode = new int[6][textSize - extOut];
374374
if (height == 0 || width == 0) {
375375
last = dmSizes[dmSizes.length - 1];
376-
e = getEncodation(text, textOffset + extOut, textSize - extOut, data, extCount, last.dataSize - extCount, options, false);
376+
e = getEncodation(text, textOffset + extOut, textSize - extOut, data,
377+
extCount, last.getDataSize() - extCount, options, false);
377378
if (e < 0) {
378379
return DM_ERROR_TEXT_TOO_BIG;
379380
}
380381
e += extCount;
381382
for (k = 0; k < dmSizes.length; ++k) {
382-
if (dmSizes[k].dataSize >= e)
383+
if (dmSizes[k].getDataSize() >= e)
383384
break;
384385
}
385386
dm = dmSizes[k];
386-
height = dm.height;
387-
width = dm.width;
387+
height = dm.getHeight();
388+
width = dm.getWidth();
388389
} else {
389390
for (k = 0; k < dmSizes.length; ++k) {
390-
if (height == dmSizes[k].height && width == dmSizes[k].width)
391+
if (height == dmSizes[k].getHeight() && width == dmSizes[k].getWidth())
391392
break;
392393
}
393394
if (k == dmSizes.length) {
394395
return DM_ERROR_INVALID_SQUARE;
395396
}
396397
dm = dmSizes[k];
397-
e = getEncodation(text, textOffset + extOut, textSize - extOut, data, extCount, dm.dataSize - extCount, options, true);
398+
e = getEncodation(text, textOffset + extOut, textSize - extOut, data,
399+
extCount, dm.getDataSize() - extCount, options, true);
398400
if (e < 0) {
399401
return DM_ERROR_TEXT_TOO_BIG;
400402
}
@@ -403,11 +405,12 @@ public int setCode(byte[] text, int textOffset, int textSize) {
403405
if ((options & DM_TEST) != 0) {
404406
return DM_NO_ERROR;
405407
}
406-
image = new byte[(dm.width + 2 * ws + 7) / 8 * (dm.height + 2 * ws)];
407-
makePadding(data, e, dm.dataSize - e);
408-
place = Placement.doPlacement(dm.height - dm.height / dm.heightSection * 2, dm.width - dm.width / dm.widthSection * 2);
409-
full = dm.dataSize + (dm.dataSize + 2) / dm.dataBlock * dm.errorBlock;
410-
ReedSolomon.generateECC(data, dm.dataSize, dm.dataBlock, dm.errorBlock);
408+
image = new byte[(dm.getWidth() + 2 * ws + 7) / 8 * (dm.getHeight() + 2 * ws)];
409+
makePadding(data, e, dm.getDataSize() - e);
410+
place = Placement.doPlacement(dm.getHeight() - dm.getHeight() /
411+
dm.getHeightSection() * 2, dm.getWidth() - dm.getWidth() / dm.getWidthSection() * 2);
412+
full = dm.getDataSize() + (dm.getDataSize() + 2) / dm.getDataBlock() * dm.getErrorBlock();
413+
ReedSolomon.generateECC(data, dm.getDataSize(), dm.getDataBlock(), dm.getErrorBlock());
411414
draw(data, full, dm);
412415
return DM_NO_ERROR;
413416
}
@@ -849,8 +852,8 @@ private int EdifactEncodation(byte[] text, int textOffset, int textLength, byte[
849852
if (!sizeFixed && (symbolIndex == text.length - 1 || symbolIndex < 0) && textLength % 4 < 3) {
850853
dataSize = Integer.MAX_VALUE;
851854
for (int i = 0; i < dmSizes.length; ++i) {
852-
if (dmSizes[i].dataSize >= dataRequired + textLength % 4) {
853-
dataSize = dmSizes[i].dataSize;
855+
if (dmSizes[i].getDataSize() >= dataRequired + textLength % 4) {
856+
dataSize = dmSizes[i].getDataSize();
854857
break;
855858
}
856859
}
@@ -990,8 +993,8 @@ private int EdifactEncodation(byte[] text, int textOffset, int textLength, byte[
990993
if (!sizeFixed && (symbolIndex == text.length - 1 || symbolIndex < 0)) {
991994
dataSize = Integer.MAX_VALUE;
992995
for (int i = 0; i < dmSizes.length; ++i) {
993-
if (dmSizes[i].dataSize >= dataOffset + ptrOut + (3 - pedi / 6)) {
994-
dataSize = dmSizes[i].dataSize;
996+
if (dmSizes[i].getDataSize() >= dataOffset + ptrOut + (3 - pedi / 6)) {
997+
dataSize = dmSizes[i].getDataSize();
995998
break;
996999
}
9971000
}
@@ -1183,38 +1186,38 @@ private void setBit(int x, int y, int xByte) {
11831186

11841187
private void draw(byte[] data, int dataSize, DmParams dm) {
11851188
int i, j, p, x, y, xs, ys, z;
1186-
int xByte = (dm.width + ws * 2 + 7) / 8;
1189+
int xByte = (dm.getWidth() + ws * 2 + 7) / 8;
11871190
Arrays.fill(image, (byte) 0);
11881191
//alignment patterns
11891192
//dotted horizontal line
1190-
for (i = ws; i < dm.height + ws; i += dm.heightSection) {
1191-
for (j = ws; j < dm.width + ws; j += 2) {
1193+
for (i = ws; i < dm.getHeight() + ws; i += dm.getHeightSection()) {
1194+
for (j = ws; j < dm.getWidth() + ws; j += 2) {
11921195
setBit(j, i, xByte);
11931196
}
11941197
}
11951198
//solid horizontal line
1196-
for (i = dm.heightSection - 1 + ws; i < dm.height + ws; i += dm.heightSection) {
1197-
for (j = ws; j < dm.width + ws; ++j) {
1199+
for (i = dm.getHeightSection() - 1 + ws; i < dm.getHeight() + ws; i += dm.getHeightSection()) {
1200+
for (j = ws; j < dm.getWidth() + ws; ++j) {
11981201
setBit(j, i, xByte);
11991202
}
12001203
}
12011204
//solid vertical line
1202-
for (i = ws; i < dm.width + ws; i += dm.widthSection) {
1203-
for (j = ws; j < dm.height + ws; ++j) {
1205+
for (i = ws; i < dm.getWidth() + ws; i += dm.getWidthSection()) {
1206+
for (j = ws; j < dm.getHeight() + ws; ++j) {
12041207
setBit(i, j, xByte);
12051208
}
12061209
}
12071210
//dotted vertical line
1208-
for (i = dm.widthSection - 1 + ws; i < dm.width + ws; i += dm.widthSection) {
1209-
for (j = 1 + ws; j < dm.height + ws; j += 2) {
1211+
for (i = dm.getWidthSection() - 1 + ws; i < dm.getWidth() + ws; i += dm.getWidthSection()) {
1212+
for (j = 1 + ws; j < dm.getHeight() + ws; j += 2) {
12101213
setBit(i, j, xByte);
12111214
}
12121215
}
12131216
p = 0;
1214-
for (ys = 0; ys < dm.height; ys += dm.heightSection) {
1215-
for (y = 1; y < dm.heightSection - 1; ++y) {
1216-
for (xs = 0; xs < dm.width; xs += dm.widthSection) {
1217-
for (x = 1; x < dm.widthSection - 1; ++x) {
1217+
for (ys = 0; ys < dm.getHeight(); ys += dm.getHeightSection()) {
1218+
for (y = 1; y < dm.getHeightSection() - 1; ++y) {
1219+
for (xs = 0; xs < dm.getWidth(); xs += dm.getWidthSection()) {
1220+
for (x = 1; x < dm.getWidthSection() - 1; ++x) {
12181221
z = place[p++];
12191222
if (z == 1 || z > 1 && (data[z / 8 - 1] & 0xff & 128 >> z % 8) != 0)
12201223
setBit(x + xs + ws, y + ys + ws, xByte);

barcodes/src/main/java/com/itextpdf/barcodes/BarcodePDF417.java

+74-20
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ protected int getTextTypeAndValue(int maxLength, int idx) {
12671267
protected boolean checkSegmentType(Segment segment, char type) {
12681268
if (segment == null)
12691269
return false;
1270-
return segment.type == type;
1270+
return segment.getType() == type;
12711271
}
12721272

12731273
/**
@@ -1280,7 +1280,7 @@ protected boolean checkSegmentType(Segment segment, char type) {
12801280
protected int getSegmentLength(Segment segment) {
12811281
if (segment == null)
12821282
return 0;
1283-
return segment.end - segment.start;
1283+
return segment.getEnd() - segment.getStart();
12841284
}
12851285

12861286

@@ -1332,19 +1332,19 @@ protected void assemble() {
13321332
cwPtr = 1;
13331333
for (k = 0; k < segmentList.size(); ++k) {
13341334
Segment v = segmentList.get(k);
1335-
switch (v.type) {
1335+
switch (v.getType()) {
13361336
case 'T':
13371337
if (k != 0)
13381338
codewords[cwPtr++] = TEXT_MODE;
1339-
textCompaction(v.start, getSegmentLength(v));
1339+
textCompaction(v.getStart(), getSegmentLength(v));
13401340
break;
13411341
case 'N':
13421342
codewords[cwPtr++] = NUMERIC_MODE;
1343-
numberCompaction(v.start, getSegmentLength(v));
1343+
numberCompaction(v.getStart(), getSegmentLength(v));
13441344
break;
13451345
case 'B':
13461346
codewords[cwPtr++] = getSegmentLength(v) % 6 != 0 ? BYTE_MODE : BYTE_MODE_6;
1347-
byteCompaction(v.start, getSegmentLength(v));
1347+
byteCompaction(v.getStart(), getSegmentLength(v));
13481348
break;
13491349
}
13501350
}
@@ -1384,12 +1384,12 @@ protected void dumpList() {
13841384
int len = getSegmentLength(v);
13851385
char[] c = new char[len];
13861386
for (int j = 0; j < len; ++j) {
1387-
c[j] = (char) (code[v.start + j] & 0xff);
1387+
c[j] = (char) (code[v.getStart() + j] & 0xff);
13881388
if (c[j] == '\r')
13891389
c[j] = '\n';
13901390
}
13911391
StringBuffer sb = new StringBuffer();
1392-
sb.append(v.type);
1392+
sb.append(v.getType());
13931393
sb.append(c);
13941394
System.out.println(sb.toString());
13951395
}
@@ -1501,7 +1501,7 @@ void breakString() {
15011501
if (checkSegmentType(v, 'B') && getSegmentLength(v) == 1) {
15021502
if (checkSegmentType(vp, 'T') && checkSegmentType(vn, 'T')
15031503
&& getSegmentLength(vp) + getSegmentLength(vn) >= 3) {
1504-
vp.end = vn.end;
1504+
vp.setEnd(vn.getEnd());
15051505
segmentList.remove(k);
15061506
segmentList.remove(k);
15071507
k = -1;
@@ -1518,13 +1518,13 @@ && getSegmentLength(vp) + getSegmentLength(vn) >= 3) {
15181518
boolean redo = false;
15191519
if (checkSegmentType(vp, 'B') && getSegmentLength(vp) == 1 || checkSegmentType(vp, 'T')) {
15201520
redo = true;
1521-
v.start = vp.start;
1521+
v.setStart(vp.getStart());
15221522
segmentList.remove(k - 1);
15231523
--k;
15241524
}
15251525
if (checkSegmentType(vn, 'B') && getSegmentLength(vn) == 1 || checkSegmentType(vn, 'T')) {
15261526
redo = true;
1527-
v.end = vn.end;
1527+
v.setEnd(vn.getEnd());
15281528
segmentList.remove(k + 1);
15291529
}
15301530
if (redo) {
@@ -1542,13 +1542,13 @@ && getSegmentLength(vp) + getSegmentLength(vn) >= 3) {
15421542
boolean redo = false;
15431543
if (checkSegmentType(vp, 'T') && getSegmentLength(vp) < 5 || checkSegmentType(vp, 'B')) {
15441544
redo = true;
1545-
v.start = vp.start;
1545+
v.setStart(vp.getStart());
15461546
segmentList.remove(k - 1);
15471547
--k;
15481548
}
15491549
if (checkSegmentType(vn, 'T') && getSegmentLength(vn) < 5 || checkSegmentType(vn, 'B')) {
15501550
redo = true;
1551-
v.end = vn.end;
1551+
v.setEnd(vn.getEnd());
15521552
segmentList.remove(k + 1);
15531553
}
15541554
if (redo) {
@@ -1558,14 +1558,14 @@ && getSegmentLength(vp) + getSegmentLength(vn) >= 3) {
15581558
}
15591559
}
15601560
// check if all numbers
1561-
if (segmentList.size() == 1 && (v = segmentList.get(0)).type == 'T' && getSegmentLength(v) >= 8) {
1562-
for (k = v.start; k < v.end; ++k) {
1561+
if (segmentList.size() == 1 && (v = segmentList.get(0)).getType() == 'T' && getSegmentLength(v) >= 8) {
1562+
for (k = v.getStart(); k < v.getEnd(); ++k) {
15631563
c = (char) (code[k] & 0xff);
15641564
if (c < '0' || c > '9')
15651565
break;
15661566
}
1567-
if (k == v.end)
1568-
v.type = 'N';
1567+
if (k == v.getEnd())
1568+
v.setType('N');
15691569
}
15701570
}
15711571

@@ -1789,9 +1789,9 @@ private void textCompaction(byte[] input, int start, int length) {
17891789
* A container that encapsulates all data needed for a segment.
17901790
*/
17911791
protected static class Segment {
1792-
public char type;
1793-
public int start;
1794-
public int end;
1792+
private char type;
1793+
private int start;
1794+
private int end;
17951795

17961796
/**
17971797
* Creates a new {@link Segment} instance.
@@ -1805,6 +1805,60 @@ public Segment(char type, int start, int end) {
18051805
this.start = start;
18061806
this.end = end;
18071807
}
1808+
1809+
/**
1810+
* Retrieves the type of the segment.
1811+
*
1812+
* @return segment type
1813+
*/
1814+
public char getType() {
1815+
return type;
1816+
}
1817+
1818+
/**
1819+
* Sets the type of the segment.
1820+
*
1821+
* @param type segment type
1822+
*/
1823+
public void setType(char type) {
1824+
this.type = type;
1825+
}
1826+
1827+
/**
1828+
* Retrieves the start of the segment.
1829+
*
1830+
* @return segment start
1831+
*/
1832+
public int getStart() {
1833+
return start;
1834+
}
1835+
1836+
/**
1837+
* Sets the start of the segment.
1838+
*
1839+
* @param start segment start
1840+
*/
1841+
public void setStart(int start) {
1842+
this.start = start;
1843+
}
1844+
1845+
/**
1846+
* Retrieves the end of the segment.
1847+
*
1848+
* @return segment end
1849+
*/
1850+
public int getEnd() {
1851+
return end;
1852+
}
1853+
1854+
/**
1855+
* Sets the end of the segment.
1856+
*
1857+
* @param end segment end
1858+
*/
1859+
public void setEnd(int end) {
1860+
this.end = end;
1861+
}
18081862
}
18091863

18101864
/**

barcodes/src/main/java/com/itextpdf/barcodes/BarcodePostnet.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ This file is part of the iText (R) project.
3535
*/
3636
public class BarcodePostnet extends Barcode1D {
3737

38-
public static int TYPE_POSTNET = 1;
39-
public static int TYPE_PLANET = 2;
38+
public static final int TYPE_POSTNET = 1;
39+
public static final int TYPE_PLANET = 2;
4040

4141
/**
4242
* The bars for each character.

0 commit comments

Comments
 (0)