Add bounds checking when looking at the stack in deprecation messages.
Add bounds checking when looking at the stack in deprecation messages.

This was breaking integration with R, fixes #25067.

PiperOrigin-RevId: 230431304

ageron/tensorflow,cxxgtxy/tensorflow,karllessard/tensorflow,aldian/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,aam-at/tensorflow,ghchinoy/tensorflow,renyi533/tensorflow,jhseu/tensorflow,Intel-tensorflow/tensorflow,petewarden/tensorflow,apark263/tensorflow,xzturn/tensorflow,adit-chandra/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,frreiss/tensorflow-fred,davidzchen/tensorflow,Intel-tensorflow/tensorflow,kevin-coder/tensorflow-fork,petewarden/tensorflow,freedomtan/tensorflow,paolodedios/tensorflow,alsrgv/tensorflow,ppwwyyxx/tensorflow,frreiss/tensorflow-fred,kevin-coder/tensorflow-fork,jhseu/tensorflow,paolodedios/tensorflow,davidzchen/tensorflow,ageron/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-pywrap_saved_model,alsrgv/tensorflow,renyi533/tensorflow,gunan/tensorflow,Intel-tensorflow/tensorflow,DavidNorman/tensorflow,frreiss/tensorflow-fred,arborh/tensorflow,Intel-Corporation/tensorflow,jhseu/tensorflow,ageron/tensorflow,ageron/tensorflow,Intel-Corporation/tensorflow,freedomtan/tensorflow,aam-at/tensorflow,apark263/tensorflow,kevin-coder/tensorflow-fork,aldian/tensorflow,ppwwyyxx/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tensorflow,alsrgv/tensorflow,alsrgv/tensorflow,ppwwyyxx/tensorflow,sarvex/tensorflow,jhseu/tensorflow,adit-chandra/tensorflow,gunan/tensorflow,freedomtan/tensorflow,jendap/tensorflow,renyi533/tensorflow,renyi533/tensorflow,paolodedios/tensorflow,Intel-tensorflow/tensorflow,apark263/tensorflow,annarev/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,annarev/tensorflow,jhseu/tensorflow,jbedorf/tensorflow,alsrgv/tensorflow,jbedorf/tensorflow,alsrgv/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,xzturn/tensorflow,annarev/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,jbedorf/tensorflow,gunan/tensorflow,theflofly/tensorflow,freedomtan/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-pywrap_saved_model,kevin-coder/tensorflow-fork,chemelnucfin/tensorflow,frreiss/tensorflow-fred,cxxgtxy/tensorflow,tensorflow/tensorflow,xzturn/tensorflow,jbedorf/tensorflow,apark263/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_tf_optimizer,yongtang/tensorflow,frreiss/tensorflow-fred,ghchinoy/tensorflow,frreiss/tensorflow-fred,cxxgtxy/tensorflow,sarvex/tensorflow,gautam1858/tensorflow,DavidNorman/tensorflow,DavidNorman/tensorflow,ghchinoy/tensorflow,gautam1858/tensorflow,jendap/tensorflow,yongtang/tensorflow,annarev/tensorflow,tensorflow/tensorflow-pywrap_saved_model,davidzchen/tensorflow,frreiss/tensorflow-fred,kevin-coder/tensorflow-fork,yongtang/tensorflow,ageron/tensorflow,xzturn/tensorflow,petewarden/tensorflow,ppwwyyxx/tensorflow,davidzchen/tensorflow,ppwwyyxx/tensorflow,paolodedios/tensorflow,jendap/tensorflow,jendap/tensorflow,chemelnucfin/tensorflow,aam-at/tensorflow,ageron/tensorflow,tensorflow/tensorflow,petewarden/tensorflow,arborh/tensorflow,Intel-tensorflow/tensorflow,annarev/tensorflow,ppwwyyxx/tensorflow,ghchinoy/tensorflow,kevin-coder/tensorflow-fork,ppwwyyxx/tensorflow,davidzchen/tensorflow,adit-chandra/tensorflow,ghchinoy/tensorflow,gunan/tensorflow,Intel-Corporation/tensorflow,adit-chandra/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,ghchinoy/tensorflow,yongtang/tensorflow,freedomtan/tensorflow,theflofly/tensorflow,gunan/tensorflow,tensorflow/tensorflow-pywrap_saved_model,alsrgv/tensorflow,karllessard/tensorflow,paolodedios/tensorflow,jhseu/tensorflow,Intel-Corporation/tensorflow,cxxgtxy/tensorflow,annarev/tensorflow,DavidNorman/tensorflow,petewarden/tensorflow,arborh/tensorflow,xzturn/tensorflow,alsrgv/tensorflow,DavidNorman/tensorflow,frreiss/tensorflow-fred,aam-at/tensorflow,adit-chandra/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow,DavidNorman/tensorflow,apark263/tensorflow,jhseu/tensorflow,ghchinoy/tensorflow,gunan/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,karllessard/tensorflow,freedomtan/tensorflow,ppwwyyxx/tensorflow,jendap/tensorflow,adit-chandra/tensorflow,tensorflow/tensorflow,jbedorf/tensorflow,tensorflow/tensorflow-pywrap_saved_model,xzturn/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,davidzchen/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,xzturn/tensorflow,apark263/tensorflow,ppwwyyxx/tensorflow,theflofly/tensorflow,DavidNorman/tensorflow,paolodedios/tensorflow,Intel-tensorflow/tensorflow,theflofly/tensorflow,freedomtan/tensorflow,apark263/tensorflow,adit-chandra/tensorflow,aldian/tensorflow,Intel-Corporation/tensorflow,annarev/tensorflow,yongtang/tensorflow,arborh/tensorflow,renyi533/tensorflow,petewarden/tensorflow,frreiss/tensorflow-fred,apark263/tensorflow,aldian/tensorflow,jendap/tensorflow,arborh/tensorflow,chemelnucfin/tensorflow,kevin-coder/tensorflow-fork,Intel-Corporation/tensorflow,aam-at/tensorflow,DavidNorman/tensorflow,Intel-Corporation/tensorflow,davidzchen/tensorflow,aam-at/tensorflow,alsrgv/tensorflow,frreiss/tensorflow-fred,gautam1858/tensorflow,sarvex/tensorflow,ageron/tensorflow,tensorflow/tensorflow-pywrap_saved_model,kevin-coder/tensorflow-fork,aldian/tensorflow,xzturn/tensorflow,jendap/tensorflow,gunan/tensorflow,petewarden/tensorflow,gunan/tensorflow,ageron/tensorflow,ageron/tensorflow,renyi533/tensorflow,renyi533/tensorflow,chemelnucfin/tensorflow,arborh/tensorflow,davidzchen/tensorflow,sarvex/tensorflow,jhseu/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,aam-at/tensorflow,karllessard/tensorflow,theflofly/tensorflow,karllessard/tensorflow,xzturn/tensorflow,tensorflow/tensorflow-pywrap_saved_model,theflofly/tensorflow,Intel-tensorflow/tensorflow,freedomtan/tensorflow,apark263/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,aam-at/tensorflow,jendap/tensorflow,petewarden/tensorflow,yongtang/tensorflow,chemelnucfin/tensorflow,Intel-tensorflow/tensorflow,renyi533/tensorflow,ppwwyyxx/tensorflow,jhseu/tensorflow,petewarden/tensorflow,arborh/tensorflow,gautam1858/tensorflow,adit-chandra/tensorflow,renyi533/tensorflow,arborh/tensorflow,frreiss/tensorflow-fred,adit-chandra/tensorflow,tensorflow/tensorflow,jbedorf/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,annarev/tensorflow,tensorflow/tensorflow,jendap/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,arborh/tensorflow,renyi533/tensorflow,tensorflow/tensorflow,yongtang/tensorflow,paolodedios/tensorflow,theflofly/tensorflow,jhseu/tensorflow,gautam1858/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,DavidNorman/tensorflow,cxxgtxy/tensorflow,paolodedios/tensorflow,apark263/tensorflow,alsrgv/tensorflow,renyi533/tensorflow,xzturn/tensorflow,chemelnucfin/tensorflow,chemelnucfin/tensorflow,adit-chandra/tensorflow,jendap/tensorflow,cxxgtxy/tensorflow,jbedorf/tensorflow,ghchinoy/tensorflow,DavidNorman/tensorflow,chemelnucfin/tensorflow,kevin-coder/tensorflow-fork,frreiss/tensorflow-fred,tensorflow/tensorflow-experimental_link_static_libraries_once,alsrgv/tensorflow,gunan/tensorflow,ageron/tensorflow,annarev/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-Corporation/tensorflow,sarvex/tensorflow,ageron/tensorflow,jhseu/tensorflow,freedomtan/tensorflow,karllessard/tensorflow,ghchinoy/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,chemelnucfin/tensorflow,cxxgtxy/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,annarev/tensorflow,tensorflow/tensorflow,theflofly/tensorflow,aam-at/tensorflow,adit-chandra/tensorflow,tensorflow/tensorflow-pywrap_saved_model,aldian/tensorflow,karllessard/tensorflow,gautam1858/tensorflow,gunan/tensorflow,jhseu/tensorflow,annarev/tensorflow,chemelnucfin/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow,renyi533/tensorflow,gunan/tensorflow,jbedorf/tensorflow,yongtang/tensorflow,arborh/tensorflow,ppwwyyxx/tensorflow,xzturn/tensorflow,jbedorf/tensorflow,ghchinoy/tensorflow,freedomtan/tensorflow,apark263/tensorflow,freedomtan/tensorflow,gautam1858/tensorflow,cxxgtxy/tensorflow,freedomtan/tensorflow,aam-at/tensorflow,theflofly/tensorflow,karllessard/tensorflow,jbedorf/tensorflow,karllessard/tensorflow,sarvex/tensorflow,jendap/tensorflow,aldian/tensorflow,DavidNorman/tensorflow,ppwwyyxx/tensorflow,petewarden/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,theflofly/tensorflow,gautam1858/tensorflow,arborh/tensorflow,ghchinoy/tensorflow,davidzchen/tensorflow,aldian/tensorflow,theflofly/tensorflow,Intel-tensorflow/tensorflow,DavidNorman/tensorflow,yongtang/tensorflow,chemelnucfin/tensorflow,sarvex/tensorflow,kevin-coder/tensorflow-fork,arborh/tensorflow,ghchinoy/tensorflow,tensorflow/tensorflow-pywrap_saved_model,chemelnucfin/tensorflow,xzturn/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,gunan/tensorflow,jbedorf/tensorflow,theflofly/tensorflow,aam-at/tensorflow,karllessard/tensorflow,kevin-coder/tensorflow-fork,aam-at/tensorflow,Intel-tensorflow/tensorflow,alsrgv/tensorflow,jbedorf/tensorflow,sarvex/tensorflow,ageron/tensorflow,tensorflow/tensorflow,davidzchen/tensorflow,adit-chandra/tensorflow