<div dir="ltr"><p>Hi,</p>
<p>I’m Priyansh, a student at IIITM Gwalior. I am applying for the erofs-rs GSoC project. I have been reading the code for a few weeks.</p>
<p>I found a small issue in <code>types.rs</code> in the function <code>xattr_size()</code>.</p><p><font face="monospace">(count - 1) * size_of::<XattrEntry>() + size_of::<XattrHeader>()</font></p>
<pre class="gmail-overflow-visible! gmail-px-0!"><div class="gmail-relative gmail-w-full gmail-mt-4 gmail-mb-1"><div class="gmail-"><div class="gmail-relative"><div class="gmail-h-full gmail-min-h-0 gmail-min-w-0"><div class="gmail-h-full gmail-min-h-0 gmail-min-w-0"><div class="gmail-border gmail-border-token-border-light gmail-border-radius-3xl gmail-corner-superellipse/1.1 gmail-rounded-3xl"><div class="gmail-h-full gmail-w-full gmail-border-radius-3xl gmail-bg-token-bg-elevated-secondary gmail-corner-superellipse/1.1 gmail-overflow-clip gmail-rounded-3xl gmail-lxnfua_clipPathFallback"><div class="gmail-pointer-events-none gmail-absolute end-1.5 gmail-top-1 gmail-z-2 gmail-md:end-2 gmail-md:top-1"></div><div class="gmail-w-full gmail-overflow-x-hidden gmail-overflow-y-auto gmail-pe-11 gmail-pt-3"><div class="gmail-relative gmail-z-0 gmail-flex gmail-max-w-full"><div id="gmail-code-block-viewer" dir="ltr" class="gmail-q9tKkq_viewer gmail-cm-editor gmail-z-10 gmail-light:cm-light gmail-dark:cm-light gmail-flex gmail-h-full gmail-w-full gmail-flex-col gmail-items-stretch gmail-ͼk gmail-ͼy"><div class="gmail-cm-scroller"><div class="gmail-cm-content gmail-q9tKkq_readonly"><span style="font-family:Arial,Helvetica,sans-serif">when </span><code>count = 1</code><span style="font-family:Arial,Helvetica,sans-serif">, it returns only 12, which is just the header size but there is also one inline entry after the header, and it is not counted.</span></div></div></div></div></div></div></div></div></div></div></div></div></pre>
<p>In line 115 on <code>filesystem.rs</code>, this value is used to find where the inline file data starts. Because of this any FlatInline inode with exactly one xattr gives wrong file data. There is no error or panic, but the output is wrong.</p>
<p>While working on this, I also built a working inline xattr parser on a real test image:<br>
<a rel="noopener" class="gmail-decorated-link" href="https://github.com/priyansh-saxena1/erofs-rs/tree/xattr-poc">https://github.com/priyansh-saxena1/erofs-rs/tree/xattr-poc<span aria-hidden="true" class="gmail-ms-0.5 gmail-inline-block gmail-align-middle gmail-leading-none"></span></a></p>
<p>I will send a patch soon to fix <code>xattr_size()</code>.</p>
<p>I have also submitted my GSoC proposal.</p>
<p>Thanks,<br>
Priyansh Saxena<br>
<a rel="noopener" class="gmail-decorated-link" href="https://github.com/priyansh-saxena1">https://github.com/priyansh-saxena1</a></p></div>