Fossil SCM

In symbolic_name_to_rid(), resolve rid:N only when N is the record number of an entry in the blob table, so that a number that names nothing or is too large is unresolved rather than passed through or wrapped. A bare "rid:" with a type is no longer an SQL error.

dmestas 2026-11-22 11:47 UTC small-fixes
Commit 0495461514060232008f79ecac5272b444939210f39fcaf21b9d4bf3b373ac9c
1 file changed +3 -2
+3 -2
--- src/name.c
+++ src/name.c
@@ -701,13 +701,14 @@
701701
702702
/* Undocumented: numeric tags get translated directly into the RID */
703703
if( strncmp(zTag, "rid:", 4)==0 ){
704704
zTag += 4;
705705
for(i=0; fossil_isdigit(zTag[i]); i++){}
706
- if( zTag[i]==0 ){
706
+ if( i>0 && zTag[i]==0 ){
707707
if( strcmp(zType,"*")==0 ){
708
- rid = atoi(zTag);
708
+ rid = db_int(0, "SELECT rid FROM blob WHERE rid=%s",
709
+ zTag /*safe-for-%s*/);
709710
}else{
710711
rid = db_int(0,
711712
"SELECT event.objid"
712713
" FROM event"
713714
" WHERE event.objid=%s"
714715
--- src/name.c
+++ src/name.c
@@ -701,13 +701,14 @@
701
702 /* Undocumented: numeric tags get translated directly into the RID */
703 if( strncmp(zTag, "rid:", 4)==0 ){
704 zTag += 4;
705 for(i=0; fossil_isdigit(zTag[i]); i++){}
706 if( zTag[i]==0 ){
707 if( strcmp(zType,"*")==0 ){
708 rid = atoi(zTag);
 
709 }else{
710 rid = db_int(0,
711 "SELECT event.objid"
712 " FROM event"
713 " WHERE event.objid=%s"
714
--- src/name.c
+++ src/name.c
@@ -701,13 +701,14 @@
701
702 /* Undocumented: numeric tags get translated directly into the RID */
703 if( strncmp(zTag, "rid:", 4)==0 ){
704 zTag += 4;
705 for(i=0; fossil_isdigit(zTag[i]); i++){}
706 if( i>0 && zTag[i]==0 ){
707 if( strcmp(zType,"*")==0 ){
708 rid = db_int(0, "SELECT rid FROM blob WHERE rid=%s",
709 zTag /*safe-for-%s*/);
710 }else{
711 rid = db_int(0,
712 "SELECT event.objid"
713 " FROM event"
714 " WHERE event.objid=%s"
715

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button