Merge lp:~pali/ubuntu/precise/util-linux/bug-1164683 into lp:ubuntu/precise/util-linux

Proposed by Pali on 2014-05-28
Status: Approved
Approved by: Marc Deslauriers on 2014-06-06
Approved revision: 89
Proposed branch: lp:~pali/ubuntu/precise/util-linux/bug-1164683
Merge into: lp:ubuntu/precise/util-linux
Diff against target: 102 lines (+39/-17)
3 files modified
AUTHORS (+1/-0)
debian/changelog (+6/-0)
libblkid/src/superblocks/udf.c (+32/-17)
To merge this branch: bzr merge lp:~pali/ubuntu/precise/util-linux/bug-1164683
Reviewer Review Type Date Requested Status
Marc Deslauriers 2014-05-28 Approve on 2014-06-06
Review via email: mp+221227@code.launchpad.net

Description of the change

Correctly read udf label with blocksize < 2048 (LP: #1164683)

To post a comment you must log in.
Marc Deslauriers (mdeslaur) wrote :

Looks good. ACK. Uploaded for processing by the SRU team. Thanks!

review: Approve

Unmerged revisions

89. By Pali on 2014-05-28

Correctly read udf label with blocksize < 2048 (LP: #1164683)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'AUTHORS'
2--- AUTHORS 2011-12-16 22:53:42 +0000
3+++ AUTHORS 2014-05-28 13:11:43 +0000
4@@ -282,4 +282,5 @@
5 Yann Droneaud <yann@droneaud.fr>
6 Yoshihiro Takahashi <ytakahashi@miraclelinux.com>
7 Yu Zhiguo <yuzg@cn.fujitsu.com>
8+ Zachary Catlin <z@zc.is>
9 Zdenek Behan <rain@matfyz.cz>
10
11=== modified file 'debian/changelog'
12--- debian/changelog 2012-03-30 04:22:22 +0000
13+++ debian/changelog 2014-05-28 13:11:43 +0000
14@@ -1,3 +1,9 @@
15+util-linux (2.20.1-1ubuntu3.1) precise; urgency=low
16+
17+ * Correctly read udf label with blocksize < 2048 (LP: #1164683)
18+
19+ -- Pali Rohár <pali.rohar@gmail.com> Wed, 28 May 2014 15:06:34 +0200
20+
21 util-linux (2.20.1-1ubuntu3) precise; urgency=low
22
23 * Build-depend on gettext:any for cross-building support.
24
25=== modified file 'libblkid/src/superblocks/udf.c'
26--- libblkid/src/superblocks/udf.c 2011-11-03 15:38:23 +0000
27+++ libblkid/src/superblocks/udf.c 2014-05-28 13:11:43 +0000
28@@ -63,17 +63,25 @@
29 struct volume_descriptor *vd;
30 struct volume_structure_descriptor *vsd;
31 unsigned int bs;
32+ unsigned int pbs[2];
33 unsigned int b;
34 unsigned int type;
35 unsigned int count;
36 unsigned int loc;
37-
38- /* search Volume Sequence Descriptor (VSD) to get the logical
39- * block size of the volume */
40- for (bs = 0x800; bs < 0x8000; bs += 0x800) {
41+ unsigned int i;
42+
43+ /* The block size of a UDF filesystem is that of the underlying
44+ * storage; we check later on for the special case of image files,
45+ * which may have the 2048-byte block size of optical media. */
46+ pbs[0] = blkid_probe_get_sectorsize(pr);
47+ pbs[1] = 0x800;
48+
49+ /* check for a Volume Structure Descriptor (VSD); each is
50+ * 2048 bytes long */
51+ for (b = 0; b < 0x8000; b += 0x800) {
52 vsd = (struct volume_structure_descriptor *)
53 blkid_probe_get_buffer(pr,
54- UDF_VSD_OFFSET + bs,
55+ UDF_VSD_OFFSET + b,
56 sizeof(*vsd));
57 if (!vsd)
58 return 1;
59@@ -87,7 +95,7 @@
60 for (b = 0; b < 64; b++) {
61 vsd = (struct volume_structure_descriptor *)
62 blkid_probe_get_buffer(pr,
63- UDF_VSD_OFFSET + ((blkid_loff_t) b * bs),
64+ UDF_VSD_OFFSET + ((blkid_loff_t) b * 0x800),
65 sizeof(*vsd));
66 if (!vsd)
67 return -1;
68@@ -101,17 +109,24 @@
69 return -1;
70
71 anchor:
72- /* read Anchor Volume Descriptor (AVDP) */
73- vd = (struct volume_descriptor *)
74- blkid_probe_get_buffer(pr, 256 * bs, sizeof(*vd));
75- if (!vd)
76- return -1;
77-
78- type = le16_to_cpu(vd->tag.id);
79- if (type != 2) /* TAG_ID_AVDP */
80- return 0;
81-
82- /* get desriptor list address and block count */
83+ /* read Anchor Volume Descriptor (AVDP), checking block size */
84+ for (i = 0; i < 2; i++) {
85+ vd = (struct volume_descriptor *)
86+ blkid_probe_get_buffer(pr, 256 * pbs[i], sizeof(*vd));
87+ if (!vd)
88+ return -1;
89+
90+ type = le16_to_cpu(vd->tag.id);
91+ if (type == 2) /* TAG_ID_AVDP */
92+ goto real_blksz;
93+ }
94+ return 0;
95+
96+real_blksz:
97+ /* Use the actual block size from here on out */
98+ bs = pbs[i];
99+
100+ /* get descriptor list address and block count */
101 count = le32_to_cpu(vd->type.anchor.length) / bs;
102 loc = le32_to_cpu(vd->type.anchor.location);
103

Subscribers

People subscribed via source and target branches

to all changes: