That happened to my father. He was in horrific pain from cancer, and the doctors refused to increase his pain meds because it would depress his ability to breathe and he would die.
He was never given a choice.
He died anyway.
Now if that patient had a living will, and it was acceptable to "kill the patient" by "overdose", then what you are saying could be done.
But, in my opinion, is what that gets down to.
For drugs like morphine, they now have "Patient Controlled Analgesics" (PCA), where the patient presses a button to administer a dose.
If someone else presses that button, they could be criminally charged. They basically could be prosecuted to administering morphine to someone.