Merge "nfc: Make NDEF validation stricter" am: f3a6269fed am: e6cb2aa614
am: 40c14a83d0
Change-Id: I7ef55eddac20d58e9184056e85c9b49e733fd38d
This commit is contained in:
@@ -805,7 +805,7 @@ public final class NdefRecord implements Parcelable {
|
|||||||
|
|
||||||
if (!mb && records.size() == 0 && !inChunk && !ignoreMbMe) {
|
if (!mb && records.size() == 0 && !inChunk && !ignoreMbMe) {
|
||||||
throw new FormatException("expected MB flag");
|
throw new FormatException("expected MB flag");
|
||||||
} else if (mb && records.size() != 0 && !ignoreMbMe) {
|
} else if (mb && (records.size() != 0 || inChunk) && !ignoreMbMe) {
|
||||||
throw new FormatException("unexpected MB flag");
|
throw new FormatException("unexpected MB flag");
|
||||||
} else if (inChunk && il) {
|
} else if (inChunk && il) {
|
||||||
throw new FormatException("unexpected IL flag in non-leading chunk");
|
throw new FormatException("unexpected IL flag in non-leading chunk");
|
||||||
@@ -839,6 +839,9 @@ public final class NdefRecord implements Parcelable {
|
|||||||
|
|
||||||
if (cf && !inChunk) {
|
if (cf && !inChunk) {
|
||||||
// first chunk
|
// first chunk
|
||||||
|
if (typeLength == 0) {
|
||||||
|
throw new FormatException("expected non-zero type length in first chunk");
|
||||||
|
}
|
||||||
chunks.clear();
|
chunks.clear();
|
||||||
chunkTnf = tnf;
|
chunkTnf = tnf;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user