WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
227606
Use more Span
https://bugs.webkit.org/show_bug.cgi?id=227606
Summary
Use more Span
Alex Christensen
Reported
2021-07-01 18:21:55 PDT
Use more Span
Attachments
Patch
(35.50 KB, patch)
2021-07-01 18:22 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(35.86 KB, patch)
2021-07-01 19:33 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(36.27 KB, patch)
2021-07-02 17:37 PDT
,
Alex Christensen
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(37.76 KB, patch)
2021-07-02 22:31 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(38.33 KB, patch)
2021-07-06 09:19 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(37.81 KB, patch)
2021-07-06 22:05 PDT
,
Alex Christensen
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Alex Christensen
Comment 1
2021-07-01 18:22:54 PDT
Created
attachment 432762
[details]
Patch
Alex Christensen
Comment 2
2021-07-01 19:33:35 PDT
Created
attachment 432763
[details]
Patch
Alex Christensen
Comment 3
2021-07-02 17:37:59 PDT
Created
attachment 432835
[details]
Patch
Alex Christensen
Comment 4
2021-07-02 22:31:35 PDT
Created
attachment 432842
[details]
Patch
Alex Christensen
Comment 5
2021-07-06 09:19:50 PDT
Created
attachment 432940
[details]
Patch
Darin Adler
Comment 6
2021-07-06 17:12:52 PDT
Comment on
attachment 432940
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=432940&action=review
> Source/WTF/wtf/persistence/PersistentDecoder.h:99 > + Span<const uint8_t>::iterator m_iterator;
We should just write const uint8_t* for this type. I don’t think this is an "iterator", it’s just a pointer. If you asked "what’s the iterator type" then, yes, you get the pointer type, but we should not try to be abstract. I think we should keep the names m_buffer and m_bufferPosition, rather than renaming to m_span and m_iterator.
Alex Christensen
Comment 7
2021-07-06 22:05:16 PDT
Created
attachment 433010
[details]
Patch
Darin Adler
Comment 8
2021-07-07 10:02:55 PDT
Comment on
attachment 433010
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=433010&action=review
> Source/WTF/wtf/persistence/PersistentDecoder.cpp:73 > + // FIXME: check for underflow. > + if (m_bufferPosition - size >= m_buffer.begin()) {
Since we know that m_bufferPosition is >= m_buffer.begin(), we can sidestep the possibility of overflow without adding an additional check by writing this: if (size <= m_bufferPosition - m_buffer.begin()) {
> Source/WebKit/NetworkProcess/cache/NetworkCacheData.h:77 > const uint8_t* data() const; > size_t size() const { return m_size; }
Maybe drop these eventually?
Alex Christensen
Comment 9
2021-07-07 10:08:44 PDT
Committed to
r279645
(In reply to Darin Adler from
comment #8
)
> Comment on
attachment 433010
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=433010&action=review
> > > Source/WTF/wtf/persistence/PersistentDecoder.cpp:73 > > + // FIXME: check for underflow. > > + if (m_bufferPosition - size >= m_buffer.begin()) { > > Since we know that m_bufferPosition is >= m_buffer.begin(), we can sidestep > the possibility of overflow without adding an additional check by writing > this: > > if (size <= m_bufferPosition - m_buffer.begin()) {
Great! It also needs a static_cast<size_t> because the right side is now signed.
> > > Source/WebKit/NetworkProcess/cache/NetworkCacheData.h:77 > > const uint8_t* data() const; > > size_t size() const { return m_size; } > > Maybe drop these eventually?
Hopefully!
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug