Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: impl/memory/gkvlite_iter.go

Issue 1911263002: Fix memory corruption bug in impl/memory (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: fix comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « impl/memory/doc.go ('k') | impl/memory/gkvlite_iter_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/gkvlite_iter.go
diff --git a/impl/memory/gkvlite_iter.go b/impl/memory/gkvlite_iter.go
index 43cc46345fae93e17df5d471f6e14a67ddd35329..2b5d7374bc51ef8246382898431d2cc012aa0b0e 100644
--- a/impl/memory/gkvlite_iter.go
+++ b/impl/memory/gkvlite_iter.go
@@ -14,7 +14,7 @@ import (
type iterDefinition struct {
// The collection to iterate over
- c *memCollection
+ c memCollection
// The prefix to always assert for every row. A nil prefix matches every row.
prefix []byte
@@ -119,6 +119,10 @@ type iterator struct {
}
func (def *iterDefinition) mkIter() *iterator {
+ if !def.c.IsReadOnly() {
+ panic("attempting to make an iterator with r/w collection")
+ }
+
cmdChan := make(chan *cmd)
ret := &iterator{
ch: cmdChan,
« no previous file with comments | « impl/memory/doc.go ('k') | impl/memory/gkvlite_iter_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698