Posted to tcl by oldlaptop at Fri Oct 24 22:40:48 GMT 2025view raw

  1. proc perpetrate_evil {{victim ::}} {
  2. array set $victim {}
  3. trace add variable $victim {read write} [list ::evil_672 $victim]
  4. }
  5.  
  6. proc evil_672 {victim empty expr op} {
  7. if {$op eq {write}} {
  8. return -code error "Evil TIP672 bans writes to the empty-named array."
  9. }
  10.  
  11. set [set victim]($expr) [uplevel 1 [list expr $expr]]
  12. }
  13.  
  14. # $ tclsh9.0
  15. # % info patchlevel
  16. # 9.0.3
  17. # % source evil-tip672.tcl
  18. # % perpetrate_evil
  19. # % puts $(1 + 1)
  20. # 2
  21.  

Add a comment

Please note that this site uses the meta tags nofollow,noindex for all pages that contain comments.
Items are closed for new comments after 1 week